You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sourcemaps break when using treeshake: 'smallest' #889
It seems when Rollup is used for extra tree-shaking, the sourcemaps no longer trace back to correct positions in the source code. This makes breakpoints effectively useless.
You might be forgetting to feed the sourcemaps into Rollup?
Reacted by lukasIO, Zhang Yang, amowel and Gautier Rollin
Besides, default output is ./dist/index.js.map. But rollup treeshake sourcemap path is ./out.js.map, result in incorrect sources path src/index.ts. The correct one should be ../src/index.ts
Activity
fix: pass sourcemap into Rollup treeShakingPlugin
chore(build): use treeshake=smallest in production only
chore(build): use treeshake=smallest in production only
xia0hj commentedon Dec 28, 2023
I met this problem too, it might be caused by incorrect use of
applySourceMapheretsup/src/plugin.ts
Lines 156 to 166 in 322cb77
correct example: https://github.com/mozilla/source-map/blob/master/test/test-source-map-generator.js#L356-L362
Besides, default output is
./dist/index.js.map. But rollup treeshake sourcemap path is./out.js.map, result in incorrect sources pathsrc/index.ts. The correct one should be../src/index.tsI fixed these 2 bugs in #1069
aleclarson commentedon Dec 28, 2023
In addition to @xia0hj's PR, there's also this one: #949 (by @hyrious)
I've not tested it myself. Interestingly, it's quite a bit different than @xia0hj's solution.
fix: pass sourcemap into Rollup treeShakingPlugin
github-actions commentedon Jul 17, 2024
🎉 This issue has been resolved in version 8.1.2 🎉
The release is available on:
Your semantic-release bot 📦🚀