Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build webpack-server in vscode #39

Closed
kkiyama117 opened this issue Sep 14, 2020 · 3 comments
Closed

Can't build webpack-server in vscode #39

kkiyama117 opened this issue Sep 14, 2020 · 3 comments

Comments

@kkiyama117
Copy link
Contributor

I've tried to build taplo-ide in my environment for transplant to vim, but I got error.

I'm beginner in wasm and rust, So I can't find what cause this bug and evaluate my way to build is correct or not. I suspect this issue is related to this error but I'm not sure. Sorry if I'm wrong.

Error message

Debugger listening on ws://127.0.0.1:46543/63284125-1b94-4376-bde6-7c6f630fa7a9
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.

> [email protected] webpack-server /(project_root)/taplo-ide/vscode
> webpack --config webpack.config.server.js --mode production

Debugger listening on ws://127.0.0.1:45305/c9a15a5e-777e-41b3-8929-039fc99e2277
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Debugger listening on ws://127.0.0.1:35467/98246438-8f84-49c7-ae87-db298bc34fc3
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Waiting for the debugger to disconnect...
Hash: 7426d92239a271a038f0
Version: webpack 4.43.0
Time: 2249ms
Built at: 2020-09-14 17:43:27
 3 assets
Entrypoint main = server.js server.js.map
[0] ../pkg/taplo_ide_bg.js 9.99 KiB {0} [built]
[1] ../pkg/taplo_ide_bg.wasm 3.01 MiB {0} [built]
[2] ./src/server.ts 599 bytes {0} [built]
[3] ../pkg/taplo_ide.js 79 bytes {0} [built]
[4] (webpack)/buildin/harmony-module.js 573 bytes {0} [built]
[5] external "fs" 42 bytes {0} [built]

ERROR in ../pkg/taplo_ide_bg.wasm
WebAssembly module is included in initial chunk.
This is not allowed, because WebAssembly download and compilation must happen asynchronous.
Add an async splitpoint (i. e. import()) somewhere between your entrypoint and the WebAssembly module:
* ./src/server.ts --> ../pkg/taplo_ide.js --> ../pkg/taplo_ide_bg.wasm
* ... --> ../pkg/taplo_ide.js --> ../pkg/taplo_ide_bg.js --> ../pkg/taplo_ide_bg.wasm
* ... --> ../pkg/taplo_ide.js --> ../pkg/taplo_ide_bg.wasm --> ../pkg/taplo_ide_bg.js --> ../pkg/taplo_ide_bg.wasm
* ... --> ../pkg/taplo_ide_bg.js --> ../pkg/taplo_ide_bg.wasm --> ../pkg/taplo_ide_bg.js --> ../pkg/taplo_ide_bg.wasm
Debugger listening on ws://127.0.0.1:45305/c9a15a5e-777e-41b3-8929-039fc99e2277
For help, see: https://nodejs.org/en/docs/inspector
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] webpack-server: `webpack --config webpack.config.server.js --mode production`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] webpack-server script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /$HOME/.npm/_logs/2020-09-14T08_43_27_211Z-debug.log

Reproduction

#(on project root directory)
cargo build
cd cargo-ide
cargo build
wasm-pack build
cd vscode
npm install -D
npm webpack

versions

cargo 1.45.1
rustup 1.22.1
wasm-pack 0.9.1
npm 6.14.6
node 12.18.3
@tamasfe
Copy link
Owner

tamasfe commented Sep 14, 2020

I use these scripts for building/packaging, and vsce runs the vsce:prepublish found in package.json.

The only difference I can spot is --target nodejs for wasm-pack, see if that works.

@kkiyama117
Copy link
Contributor Author

Thank you for your advice! I did it. I really appreciate your kindness.

@tamasfe
Copy link
Owner

tamasfe commented Sep 14, 2020

I'm glad you're interested in the project!

If you wish to use the server for vim, it might probably be better to compile it to native instead of WASM. It was designed with WASM in mind so that it is platform-agnostic and can be easily packaged for vscode, but vim might have different requirements. As far as I remember, there is not a whole lot of WASM-reliant code, and shouldn't take too much effort to reimplement these, tell me if you need further help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants