You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am on the latest version of Snowpack & all plugins.
I use package manager ____ (Fill in: npm, yarn, pnpm, etc).
I run Snowpack on OS ____ (Fill in: Windows, Mac, Linux, etc).
I run Snowpack on Node.js v12+
Describe the bug
Snowpack somehow always assume the image paths are from the root level.
If a component not at root level tries to import an image with relative path, the bundled url would be incorrect.
To Reproduce
For instance, in the snowpack typescript react template, if I have a Logo component at src/components/Logo.tsx and have an import statement:
import logo from './img/logo.svg';
Then I build the project with the internal esbuild optimizer:
optimize: {
bundle: true,
},
The bundled /index.js would compile to:
// build/dist/components/Logo.js
import logo from "./img/logo.svg";
Which points to /dist/img/logo.svg instead of /dist/components/img/logo.svg
Expected behavior
The image import should work.
Anything else?
The text was updated successfully, but these errors were encountered:
Bug Report Quick Checklist
Describe the bug
Snowpack somehow always assume the image paths are from the root level.
If a component not at root level tries to import an image with relative path, the bundled url would be incorrect.
To Reproduce
For instance, in the snowpack typescript react template, if I have a Logo component at
src/components/Logo.tsx
and have an import statement:Then I build the project with the internal esbuild optimizer:
The bundled /index.js would compile to:
Which points to
/dist/img/logo.svg
instead of/dist/components/img/logo.svg
Expected behavior
The image import should work.
Anything else?
The text was updated successfully, but these errors were encountered: