Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [3.1.2] Assets don't get proxies when optimize.bundle is true #2996

Open
4 tasks done
fgblomqvist opened this issue Mar 25, 2021 · 0 comments
Open
4 tasks done
Assignees
Labels
bug Something isn't working

Comments

@fgblomqvist
Copy link

Bug Report Quick Checklist

  • I am on the latest version of Snowpack & all plugins.
  • I use package manager npm (Fill in: npm, yarn, pnpm, etc).
  • I run Snowpack on OS Mac (Fill in: Windows, Mac, Linux, etc).
  • I run Snowpack on Node.js v12+

Describe the bug

If you enable bundling through the built-in optimize.bundle, assets will not get proxies generated/their imports changed. E.g. they end up just as-is:
import logo from "./logo.svg"; -> import logo from "./logo.svg";
which naturally leads to errors in the browser.

If you leave bundle: false things work as expected:
import logo from "./logo.svg"; -> import logo from "./logo.svg.proxy.js";

To Reproduce

We can't fix bugs that we can't see for ourselves. Issues often need to be closed if this section is skipped.

  1. npx create-snowpack-app new-dir --template @snowpack/app-template-react-typescript
  2. Set optimize.bundle to true in the snowpack.config.js
  3. npm run build
  4. Inspect the index.js, search for .svg and you'll find the SVG import as raw.
  5. You can also see that there was no proxy-file generated.

Expected behavior

I'm guessing at the very least, that there should be proxies generated and the imports should be swapped.

Anything else?

I'm not sure if this worked as intended in 3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants