Skip to content
New issue

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

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

Already on GitHub? # to your account

Conflict between builtins and mangle-names #568

Closed
btmills opened this issue Jun 6, 2017 · 0 comments · Fixed by #579
Closed

Conflict between builtins and mangle-names #568

btmills opened this issue Jun 6, 2017 · 0 comments · Fixed by #579
Labels
bug Confirmed bug

Comments

@btmills
Copy link
Contributor

btmills commented Jun 6, 2017

(This has been moved from PR #565)

This demonstrates a conflict between babel-plugin-minify-builtins and babel-plugin-minify-mangle-names. When a property on Math or Number is referenced twice in an array literal inside a function, only the second reference gets updated with the mangled name.

// in.js
function a() {
    [Math.pi, Math.pi];
}
// out.js
function a() {
    var a = Math.pi;
    [_Mathpi, a];
}
// .babelrc
{
	"plugins": [
		"minify-builtins",
		"minify-mangle-names"
	]
}

This appears to happen only for Math or Number properties - I tried Array, Boolean, Date, and a few others, none of which had this issue.

I pushed up a runnable example to btmills/babili-mangle-builtins-conflict, so you can clone, install, and test if that's easier.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Confirmed bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants