trunk icon indicating copy to clipboard operation
trunk copied to clipboard

Minification removing wasmbindgen getters

Open dt665m opened this issue 1 year ago • 3 comments

Describe the Bug

This issue was first filed at wasm-bindgen here. It seems like someone there found that the minifier that trunk uses is removing some of the getter JS emitted by WasmBindgen in Release mode.

Steps to Reproduce

  • wasm-bindgen 0.2.92
  • I'm using OSX Sonoma on Apple Silicon and Chrome 123.x
  • clone this minimal repro
  • install trunk cargo install --locked trunk
  • serve with trunk serve
  • open browser at localhost:8080. Observe console log of "hello world"
  • serve with trunk serve --release
  • open browser at localhost:8080. Observe console log of "function...."

Expected Behavior

Debug and Release should be the same

Actual Behavior

Differing results in Debug and Release. See this comment

dt665m avatar Apr 07 '24 17:04 dt665m

As trunk only calls minify-js, I think you would need to raise an issue with them: https://github.com/wilsonzlin/minify-js

With trunk, you can disable minification in release builds, using data-no-minify on assets or --no-minification globally.

ctron avatar Apr 10 '24 08:04 ctron

As trunk only calls minify-js, I think you would need to raise an issue with them: https://github.com/wilsonzlin/minify-js

With trunk, you can disable minification in release builds, using data-no-minify on assets or --no-minification globally.

Agreed, I have also made an issue over there. However, the issue being here is still valuable as maybe a discussion can be had to disable minification by default when building for release. It seems like this isn't the only issue with minification. There is at least #750 and #758 on the first page besides this one. Perhaps it can also be documented somewhere that debug and release may have dragons because of unstable minification since it is enabled automatically.

dt665m avatar Apr 12 '24 16:04 dt665m

I am leaning towards closing this one, as it not directly a trunk issue, and the minification defaults will change in 0.20.0.

ctron avatar Apr 23 '24 11:04 ctron