-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
I'm using solid-start and trying to load a local package.
If the node_modules/mypackage folder doesn't exist or it exists but isn't empty, I get the error.
I know this part of the buildStart() hook is where the error happens.
vite-plugin-wasm-pack/src/index.ts
Lines 121 to 125 in 5e626b9
| try { | |
| await fs.copy(pkgPath, path.join('node_modules', crateName)); | |
| } catch (error) { | |
| this.error(`copy crates failed: ${error}`); | |
| } |
The buildStart() gets called 3 times because vinxi (used by solidstart) starts 3 apps with the same vite config as explained here (nksaraf/vinxi#262 (comment))
It makes sense that running await fs.copy 3 times at once causes issues. And the comment suggests this as a solution which worked for me.
import { defineConfig } from "@solidjs/start/config";
import wasmpack from "vite-plugin-wasm-pack";
export default defineConfig({
vite({ router }) {
return {
plugins: router === "client" ? [wasmpack("./mypackage")] : []
}
}
})I don't know if this is something this plugin could/should address, but I hope this solution helps someone else.
Metadata
Metadata
Assignees
Labels
No labels