rustwasm / rust-webpack-template

Kickstart your Rust, WebAssembly, and Webpack project!
Apache License 2.0
567 stars 75 forks source link

Crate in sub directory causes pkg to be created in the root. #165

Closed GeraldHost closed 4 years ago

GeraldHost commented 4 years ago

This may be intended behaviour and I'm missing something so apologies if that is the case.

When I nest my rust code in a subdirectory an run a build. A pkg directory is created in the root of my project with an empty index.js file in it. Everything else is working as expected, a pkg folder still gets created in my rust subdirectory and I can consume the index.js from there as expected.

Steps to Reproduce

  1. npm init rust-webpack my-app
  2. cd my-app && mkdir rust
  3. mv src tests Cargo.toml rust
  4. Update your webpack WasmPackPlugin crateDirectory to path.resolve(__dirname, 'rust')
  5. npm run build
  6. you will see that a pkg with an empty index.js file has been created in the root.

Expected Behavior

It shouldn't create the pkg folder in the root.

GeraldHost commented 4 years ago

Closing as this is not the right place for this. This is: https://github.com/wasm-tool/wasm-pack-plugin/issues/87