New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty sourcemaps when using bannerNewLine = true. #133

Closed
ealmansi opened this Issue Oct 4, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@ealmansi

ealmansi commented Oct 4, 2018

Steps to reproduce the issue

Add bannerNewLine: true to your rollup-plugin-babel-minify config.

Expected result

Newline should be added after banner, sourcemaps should not be cleared.

Actual result

Newline is added after banner, but sourcemaps also get cleared. By cleared, I mean that I get the following:

{"version":3,"file":"moneybutton.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}

Disabling this option yields the complete sourcemaps.

Other details

Looking at the code, the bug seems to be in this line:

https://github.com/Comandeer/rollup-plugin-babel-minify/blob/master/src/index.js#L50

When calling addNewLine, the source maps generated by transform are completely disregarded.

Version of package: 6.0.0

Node.js & npm versions: 8.11.3 , 5.6.0

Operating system: Ubuntu 18.04.1 LTS

@Comandeer Comandeer added the bug label Oct 4, 2018

@Comandeer

This comment has been minimized.

Owner

Comandeer commented Oct 5, 2018

It will be a little tricky one… First I thought about simply using map generated before adding the new line, but obviously it won't work (or – at best – the whole sourcemap will be shifted by one line). Seems like I need to somehow combined two generated sourcemaps 🤔 There are some npm packages for that and I'm also thinking about index map. I need to check which one will suit lib better.

@Comandeer

This comment has been minimized.

Owner

Comandeer commented Oct 7, 2018

Just released 6.1.1, which should fix this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment