Skip to content
This repository has been archived by the owner on Mar 15, 2020. It is now read-only.

Empty sourcemaps when using bannerNewLine = true. #133

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

Empty sourcemaps when using bannerNewLine = true. #133

ealmansi opened this issue Oct 4, 2018 · 2 comments
Labels
Milestone

Comments

@ealmansi
Copy link

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
Copy link
Owner

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
Copy link
Owner

Just released 6.1.1, which should fix this issue!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants