Skip to content

build command with --out-name that contains dots, ., generates incorrect files #697

Open
@torch2424

Description

@torch2424

🐛 Bug description

When creating a PR for #313, and is a bit of a blocker if we want to follow the . semantic of how JS is usually output for libraries 😞 , I noticed that the --out-name flag does not work properly if it contains a . character. I assume this is also an issue with wasm-bindgen, but it would also affect what we do here.

I think this is better done by showing in examples. I'll use the node target since it requires the _bg.js shim, which also doesn't generate correctly.

Examples:

Happy Case:

Expected output

Screenshot from 2019-08-04 02-26-18

Case where name contains *.js:

  • Correctly ignores the .js extension when generating the main files.
  • Missing shim
  • wasm file is incorrectly names
  • package json references non-existant files

Screenshot from 2019-08-04 02-27-06

Case where name contains *.somerandomextension:

  • Generated files ignore the extension
  • Package.json references the correctly names files, but they were generated incorrectly

Screenshot from 2019-08-04 02-32-16

Case where name contains *.*.js:

  • Correctly ignores the .js extension when generating the main files.
  • Missing shim
  • wasm file is incorrectly names
  • package json references non-existant files

Screenshot from 2019-08-04 02-30-35

🤔 Expected Behavior

Whenever there is a . in the --out-name, it should respect the additional extensions, and then build off of them. There probably is some discussion points of:

  • How should the _bg be handled?
  • Should .js or .wasm be ignored?
  • Do we only want to solve this on the wasm-bindgen layer, and then not allow the extensions on the wasm-pack layer?

👟 Steps to reproduce

Please see the examples screenshots 😄

🌍 Your environment

Include the relevant details of your environment.
wasm-pack version: current master
rustc version: 1.34.1

Screenshot from 2019-07-31 01-11-56

pop_OS! is a derivative of Ubuntu 😄

Thank you! 😄

cc @ashleygwilliams @alexcrichton @ibaryshnikov (since @ibaryshnikov opened #599 , and I see ya'll in the rust/wasm WG meetings 😄 )

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions