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
error when starting dev server:
Error: ENOENT: no such file or directory, open '~/mre_vite_outside/my-crate/www/...js'
at Object.openSync (node:fs:590:3)
at Object.readFileSync (node:fs:458:35)
at prepareBuild (~/mre_vite_outside/my-crate/www/node_modules/vite-plugin-wasm-pack/dist/index.js:125:47)
at async Context.buildStart (~/mre_vite_outside/my-crate/www/node_modules/vite-plugin-wasm-pack/dist/index.js:132:17)
at async Promise.all (index 2)
at async Object.buildStart (~/mre_vite_outside/my-crate/www/node_modules/vite/dist/node/chunks/dep-689425f3.js:39230:13)
at async Server.httpServer.listen (~/mre_vite_outside/my-crate/www/node_modules/vite/dist/node/chunks/dep-689425f3.js:60350:21)
and the contents of my-crate/pkg are copied to to my-crate/www, which results in package.json being overridden.
I've found two workarounds to this; the first is to go up another directory and then name the directory that you came from, which may not work if the crate is also the root of the repo and the repo folder was named differently than expected; the second workaround is to use node's path.resolve method to get an absolute path to ../.
My guess as to why this is a problem is because you're expecting the name of the crate in the last segment of the path?
Yeah. I went down a rabbit hole upon finding this issue. Really it can be fixed by using path.resolve() in the plugin, to get the whole directory structure, because it pulls the crate name off of the last bit of the directory pointed to. Quick fix is ../../my_crate.
But I saw a whole bunch of stuff I wanted to do differently and forked off. We'll see if it ends up merged back into this repo or if I publish with a different name; but check it out. https://github.com/Identikey/vite-plugin-wasm-pack
It runs the wasm-pack command for you and then loads it directly.
The error given is
and the contents of
my-crate/pkg
are copied to tomy-crate/www
, which results inpackage.json
being overridden.I've found two workarounds to this; the first is to go up another directory and then name the directory that you came from, which may not work if the crate is also the root of the repo and the repo folder was named differently than expected; the second workaround is to use node's
path.resolve
method to get an absolute path to../
.My guess as to why this is a problem is because you're expecting the name of the crate in the last segment of the path?
I've made a minimal reproducible example here: https://github.com/chinoto/mre_vite-plugin-wasm-pack_outside/tree/Fail
My workarounds are the last two commits of the master branch: https://github.com/chinoto/mre_vite-plugin-wasm-pack_outside/commits/master
The text was updated successfully, but these errors were encountered: