Replies: 1 comment 2 replies
-
There was a bug. Scanner and optimizer shouldn't read wasm files but it was reading them: #9257 BTW I'm having an error even with the PR above. ( |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm the author of vite-plugin-wasm. This plugin aims at adding WebAssembly ESM integration to Vite.
Most users of WebAssembly ESM integration are users
wasm-pack
-generated NPM packages. So this plugin often does process the code innode_modules
. It works fine in Vite's Rollup build but breaks withoptimizeDeps
.With
optimizeDeps
turned on (by default it's turned on in dev server), The code innode_modules
are processed by ESBuild first, passingimport "filename.wasm"
to ESBuild, which is not supported and resulting in an error. Currently the solution is adding thewasm-pack
-generated package tooptimizeDeps.exclude
.It is a common or very rare situation that a NPM package must be processed by a Vite plugin to be imported successfully? Will there be a better solution without manually adding packages to
optimizeDeps.exclude
, e.g. some API to let the plugin to tell ESBuild to skip processing some type of files like\.wasm$
?Beta Was this translation helpful? Give feedback.
All reactions