The rust implementation of webpack-sources
with WebAssembly Node.js API.
First, install webpack-cli
, webpack
, and wasm-webpack-sources
in your local project:
npm install webpack wasm-webpack-sources https://github.com/jevancc/webpack-cli
After the installation, you can try the experimental WebAssembly package with argument -r wasm-webpack-sources
:
npx webpack -r wasm-webpack-sources
When the module is successfully loaded, you will see the following message:
Override:
<webpack-sources resolve> -> <wasm-webpack-sources resolve>
You are now using experimental package `wasm-webpack-sources`
You can install this package with yarn under an alias to try it with your local Webpack:
yarn add webpack-sources@npm:wasm-webpack-sources
This command will replace webpack-soruces
with wasm-webpack-sources
in node_modules
.
- The size of file is stored in 32bit signed integer, hence this package does not support files larger than 2GB.
- In order to use this package you will need Node.js version 8 or above.
No. The API of this package is 100% compatible with the JS package webpack-sources
. You just need to override the requiring of webpack-sources
with wasm-webpack-sources
and everything can work perfectly.
There is no deallocation in current release.
The deallocation process invloves extra works to be made in webpack and plugins which use and create objects with webpack-sources
. So far, these works haven't be done so it may impose the potential risk of memory leak.
Be careful when you are using it in the cases where process is not exited after the compilation such as dev-server
.
The released npm package and this repository contains the latest WebAssembly binary, so there is no need for you to build the binary yourself to use it unless you want to test it.
This package is written in Rust with wasm-bindgen
. To build the WebAssembly on your own, you need to install the requirements:
- Rust nightly
wasm32-unknown-unknown
targetwasm-bindgen
You can follow the guide of wasm-bindgen
to setup everything you need.
After the enviroment is set-up, you can build the WebAssembly binary with the npm script:
npm run build:wasm
This script will place the binary and JS interface generated by wasm-bindgen
in wasm-api/build
.
- webpack / webpack-sources
- webpack / webpack