Closed filipw01 closed 1 year ago
Closing temporarily as I missed one thing in reproduction and after fixing it it seems to work. I need to provide a better one because I definitely see an issue locally
Found the actual issue, renamed issue and edited description
I was able to reproduce this with a vanilla Vite project, and it looks like Vite is tracking this bug in this issue.
Closing since it's a Vite issue.
@filipw01 This is a truly perfect minimal reproduction. Thank you! 🤗
We should add a link to a CRXJS project on StackBlitz, it makes everything so easy.
I didn't think it might be an issue with Vite itself. Thank you for the link. I might find a moment to add a link to StackBlitz somewhere
@jacksteamdev I created this vanilla js project which I think we could link in the issue template https://stackblitz.com/edit/stackblitz-webcontainer-api-starter-humgcr
Feel free to fork it with your account to be in full control of it
Build tool
Vite
Where do you see the problem?
Describe the bug
There is a page declared in
vite.config.js
-page.html
importing./main.js
When there is
"sideEffects": false
declared inpackage.json
vite bundles only modulepreload polyfill ignoringmain.js
When there is no
"sideEffects": false
declared inpackage.json
vite correctly bundles both modulepreload polyfill andmain.js
file into one fileWhen
page.html
imports/main.js
instead (absolute path) it works as expected bundling both modulepreload polyfill andmain.js
file into one fileMy fix is to use absolute paths, but I would expect either an error or relative paths working as expected
Reproduction
https://stackblitz.com/edit/stackblitz-webcontainer-api-starter-ukxxhl?file=package.json
Logs
No response
System Info
You can see everything in reproduction too, but for me it's
Severity
annoyance