diff options
Diffstat (limited to 'docs/bundler/loaders.md')
-rw-r--r-- | docs/bundler/loaders.md | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/docs/bundler/loaders.md b/docs/bundler/loaders.md index 7cac75648..5c88fbc9b 100644 --- a/docs/bundler/loaders.md +++ b/docs/bundler/loaders.md @@ -222,7 +222,7 @@ If a value is specified for `publicPath`, the import will use value as a prefix {% callout %} The location and file name of the copied file is determined by the value of [`naming.asset`](/docs/cli/build#naming). -{% callout %} +{% /callout %} This loader is copied into the `outdir` as-is. The name of the copied file is determined using the value of `naming.asset`. {% details summary="Fixing TypeScript import errors" %} @@ -232,3 +232,15 @@ If you're using TypeScript, you may get an error like this: // TypeScript error // Cannot find module './logo.svg' or its corresponding type declarations. ``` + +This can be fixed by creating `*.d.ts` file anywhere in your project (any name will work) with the following contents: + +```ts +declare module "*.svg" { + const content: string; + export default content; +} +``` + +This tells TypeScript that any default imports from `.svg` should be treated as a string. +{% /details %} |