Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

UglifyJSPlugin breaks alias module (mapbox-gl) #189

Closed
webpack-bot opened this issue Dec 6, 2017 · 3 comments
Closed

UglifyJSPlugin breaks alias module (mapbox-gl) #189

webpack-bot opened this issue Dec 6, 2017 · 3 comments

Comments

@webpack-bot
Copy link

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
When building for production, UglifyJSPlugin causes Mapbox to throw an Reference Error: n is not defined. Compiling/building works fine without UglifyJSPlugin.

If the current behavior is a bug, please provide the steps to reproduce.
I am using VueJS with webpack, and load Mapbox via

function resolve (dir) {
  return path.join(__dirname, '..', dir)
}
...
alias: {
      'mapbox-gl': resolve('node_modules/mapbox-gl/dist/mapbox-gl.js'),
      'webworkify': 'webworkify-webpack'
}

because of this incompatibility.
In my vue-file, Mapbox is imported as import mapboxgl from 'mapbox-gl';.

My build configuration:
Base:
https://gist.github.com/henningko/5a76d12a14e485bfc4dd62c2e50ad08e
Production:
https://gist.github.com/henningko/3387f41a55558af60205ea00bbc6b530

What is the expected behavior?
The build should run without Reference Errors produces—or provide a way to leave mapbox-gl untouched.

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
OS X 10.12.3
Node v7.6
npm 4.4
webpack 2.2.1

Thanks :)


This issue was moved from webpack/webpack#4414 by @evilebottnawi. Orginal issue was by @henningko.

@alexander-akait
Copy link
Member

alexander-akait commented Dec 6, 2017

Seems issue was solved, but we should add tests to avoid problem in future

@kzc
Copy link

kzc commented Dec 6, 2017

@michael-ciniawsky
Copy link
Member

Especially mishoo/UglifyJS#2520 (comment)

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

No branches or pull requests

4 participants