If you have a crateDirectory located elsewhere in your filesystem, the plugin will still create an empty ./<outDir> folder locally to the main build process root.
Example:
new WasmPackPlugin({
crateDirectory: path.resolve(__dirname, "./myRustPlugin")
})
This would create an empty pkg subfolder in ./pkg, and not in ./myRustPlugin/pkg as expected (and according to wasm-pack build).
Note that currently it is possible to workaround this issue by enforcing a full qualified path outDir to the destination pkg location, like so:
new WasmPackPlugin({
crateDirectory: path.resolve(__dirname, "./myRustPlugin"),
outDir: path.resolve(__dirname, "./myRustPlugin/pkg")
})
But if you simply use outDir: "build" or leave outDir to the "pkg" default, the problem arises.
The problem appears to be here:
|
fs.mkdirSync(this.outDir); |
If you have a
crateDirectorylocated elsewhere in your filesystem, the plugin will still create an empty./<outDir>folder locally to the main build process root.Example:
This would create an empty
pkgsubfolder in./pkg, and not in./myRustPlugin/pkgas expected (and according towasm-pack build).Note that currently it is possible to workaround this issue by enforcing a full qualified path
outDirto the destinationpkglocation, like so:But if you simply use
outDir: "build"or leaveoutDirto the"pkg"default, the problem arises.The problem appears to be here:
wasm-pack-plugin/plugin.js
Line 98 in a0b20c0