Skip to content
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

Cannot minify repo during Webpack build #60

Open
ryanhamley opened this issue Oct 30, 2017 · 0 comments
Open

Cannot minify repo during Webpack build #60

ryanhamley opened this issue Oct 30, 2017 · 0 comments

Comments

@ryanhamley
Copy link
Contributor

Import repo:
import MapboxCircle from 'mapbox-gl-circle';

Summary:
Run Webpack to build the codebase with Webpack's UglifyJsPlugin on. Webpack is attempting to minify all the files in the codebase, but cannot handle ES6 code, resulting in an error.

Error:
ERROR in <file>.js from UglifyJs Unexpected token: name (MapboxCircle)

Workaround:
import MapboxCircle from 'mapbox-gl-circle/dist/mapbox-gl-circle.min.js'

Importing the minified file seems to be an acceptable workaround for the time being.

Solution:
I don't believe this is limited to Webpack. I'm guessing any minification would result in this error. ES6 code could still cause errors in older browsers as well if not transpiled to ES5. It would be nice if the main file for importing was transpiled to ES5 so that it could be imported as mapbox-gl-circle; building and minifying would work well and unbuilt/unminified code could be assumed to work in older browsers.

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

No branches or pull requests

2 participants