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
When I build a cloudflare page's demo (sveltekit), throw error following:
node_modules/.pnpm/@dqbd+tiktoken@1.0.7/node_modules/@dqbd/tiktoken/tiktoken.js:1:22: ERROR: No loader is configured for ".wasm" files: node_modules/.pnpm/@dqbd+tiktoken@1.0.7/node_modules/@dqbd/tiktoken/tiktoken_bg.wasm
at failureErrorWithLog (D:\WebStormProjects\somedemo2\my-app\node_modules\.pnpm\esbuild@0.17.18\node_modules\esbuild\lib\main.js:1636:15)
at D:\WebStormProjects\somedemo2\my-app\node_modules\.pnpm\esbuild@0.17.18\node_modules\esbuild\lib\main.js:1048:25
at D:\WebStormProjects\somedemo2\my-app\node_modules\.pnpm\esbuild@0.17.18\node_modules\esbuild\lib\main.js:993:52
at buildResponseToResult (D:\WebStormProjects\somedemo2\my-app\node_modules\.pnpm\esbuild@0.17.18\node_modules\esbuild\lib\main.js:1046:7)
at D:\WebStormProjects\somedemo2\my-app\node_modules\.pnpm\esbuild@0.17.18\node_modules\esbuild\lib\main.js:1075:16
at responseCallbacks.<computed> (D:\WebStormProjects\somedemo2\my-app\node_modules\.pnpm\esbuild@0.17.18\node_modules\esbuild\lib\main.js:697:9)
at handleIncomingPacket (D:\WebStormProjects\somedemo2\my-app\node_modules\.pnpm\esbuild@0.17.18\node_modules\esbuild\lib\main.js:752:9)
at Socket.readFromStdout (D:\WebStormProjects\somedemo2\my-app\node_modules\.pnpm\esbuild@0.17.18\node_modules\esbuild\lib\main.js:673:7)
at Socket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:324:12)
If the wasm is inside my source file, I can build done. But, it It doesn't seem to can load from node_modules.
Do you have any ideas?
The text was updated successfully, but these errors were encountered:
If you're importing the wasm file through import binary from 'path/to/lib.wasm', then you can use the example WebAssembly plugin to load that.
If it was referenced via new URL('./lib.wasm', import.meta.url) or something like that, it is tracked in #795.
Note that even if the wasm file is not imported directly, you still have the ability to change that to direct import through plugins API. Here's a solution for another issue but it may also be helpful to you #3039 (comment)
This intentionally isn't something that esbuild automatically does for you. Loading WebAssembly code involves external assets, and how to do that is case-dependent. You need to configure esbuild to tell it how you want it to do that (e.g. by using a plugin) depending on your use case.
I'm closing this issue because the fact that esbuild's default configuration generates the error No loader is configured for ".wasm" files when you import a .wasm file is not a bug with esbuild.
When I build a cloudflare page's demo (sveltekit), throw error following:
If the wasm is inside my source file, I can build done. But, it It doesn't seem to can load from node_modules.
Do you have any ideas?
The text was updated successfully, but these errors were encountered: