Closed Bisstocuz closed 2 years ago
I use console.log
to print import.meta.url
, it got http://localhost/src/views/Test.vue?t=1640423767507
Interesting! Do you have an example git repository where I could debug this? That would be super convenient.
Interesting! Do you have an example git repository where I could debug this? That would be super convenient.
https://github.com/Bisstocuz/jSquash-Issue-8 Hi, this is reproduction above.
Use npm run dev
to start Dev server, and use npm run build
then npm run preview
to run Production server.
@Bisstocuz This is a big help, thank you. Will take a look later 🤓
Hmm, looks like this is an issue with Vite itself:
A possible workaround looks likely to be updating your Vite config with:
optimizeDeps: {
exclude: ["@jsquash/png"],
},
See: https://github.com/nshen/test-npm-crate/issues/1
We could compile the Rust/Wasm JS glue code specially for Vite, but I'll leave that as a last resort. Would prefer there to be a more complete solution from the Vite side.
Would this resolve your issue for the time being?
optimizeDeps: { exclude: ["@jsquash/png"], },
Many libraries will use optimizeDeps
to solve some issues.
This solution can solve my issue, no need to do more works.
And the other suggestion is that you can add this to your README.md
.
Thanks!
I'm using latest Vue3+Vite2, this package is pretty good (I successfully tested it on production build).
Description
My codes:
When I test it on Dev server, I got a TypeError for URL:
located at:
After I build it by
npm run build
and test this on production build, everything works as normal. I believe this issue is related to Vite's esbuild module or another, but I can make sure what caused this.How to produce
npm init vite@latest
npm run dev
Thanks!