question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error using uglify

See original GitHub issue

Hi !

When I try to build the app for production, I get an error with uglify.

See the trace below

→ yarn webpack --env.DEPLOY_ENV=uat
yarn run v1.13.0
$ /Users/nicolasbouliol/inshop/dashshop-frontend/node_modules/.bin/webpack --env.DEPLOY_ENV=uat
Hash: 7cf696c60014fd186e1e
Version: webpack 4.29.6
Time: 33112ms
Built at: 05/17/2019 2:18:50 PM
 15 assets
Entrypoint app = js/runtime~app.bundle.js js/vendors~6e8b5f81.bundle.js js/vendors~0b3b47da.bundle.js js/vendors~2a42e354.bundle.js js/vendors~7529033b.bundle.js js/vendors~f8ab3d97.bundle.js js/vendors~7274e1de.bundle.js js/vendors~d939e436.bundle.js js/vendors~1f20a385.bundle.js js/vendors~9c5b28f6.bundle.js js/vendors~acda4ad0.bundle.js js/vendors~678f84af.bundle.js js/vendors~fd731fb0.bundle.js js/vendors~df0f15aa.bundle.js js/app~748942c6.bundle.js
  [27] ./node_modules/@aspnet/signalr/dist/esm/index.js + 14 modules 106 KiB {6} [built]
       |    15 modules
  [38] (webpack)/buildin/global.js 472 bytes {5} [built]
  [50] ./node_modules/react-redux/es/index.js + 15 modules 35.1 KiB {12} [built]
       |    16 modules
 [185] (webpack)/buildin/module.js 497 bytes {5} [built]
 [201] ./node_modules/antd/es/layout/index.js + 2 modules 18.1 KiB {4} [built]
       |    3 modules
 [267] ./node_modules/react-cookie/es6/index.js + 5 modules 6.81 KiB {12} [built]
       |    6 modules
 [269] ./node_modules/universal-cookie/es6/index.js + 2 modules 4.38 KiB {5} [built]
       |    3 modules
 [339] ./node_modules/css-loader??ref--6-1!./node_modules/sass-loader/lib/loader.js??ref--6-2!./node_modules/sass-resources-loader/lib/loader.js??ref--6-3!./src/App.scss 7.66 KiB {0} [built]
 [682] ./node_modules/@aspnet/signalr-protocol-msgpack/dist/esm/index.js + 3 modules 13.3 KiB {6} [built]
       |    4 modules
 [690] multi babel-polyfill ./src/index.tsx 40 bytes {0} [built]
[1126] ./src/App.scss 1.42 KiB {0} [built]
[1196] ./node_modules/moment/locale sync ^\.\/.*$ 3 KiB {0} [optional] [built]
[1247] ./src/index.tsx + 84 modules 121 KiB {0} [built]
       | ./src/index.tsx 1020 bytes [built]
       | ./src/shared/helpers/auth.ts 1.22 KiB [built]
       | ./src/store/hubConnections.ts 1.99 KiB [built]
       | ./src/store/configureStore.ts 1.67 KiB [built]
       | ./src/AppContainer.tsx 5.72 KiB [built]
       | ./src/store/authentications/actions.ts 227 bytes [built]
       | ./src/DevTools.tsx 394 bytes [built]
       | ./src/shared/helpers/getSsoCreds.ts 1.66 KiB [built]
       | ./src/shared/helpers/getApiBaseUri.ts 571 bytes [built]
       | ./src/store/redirections/actions.ts 605 bytes [built]
       | ./src/store/users/actions.ts 682 bytes [built]
       | ./src/store/dashboards/actions.ts 1.28 KiB [built]
       | ./src/store/authentications/types.ts 224 bytes [built]
       | ./src/store/combiners.ts 2.6 KiB [built]
       | ./src/App.tsx 4.2 KiB [built]
       |     + 70 hidden modules
[1256] ./node_modules/redux-observable/lib/esm/createEpicMiddleware.js + 17 modules 28.3 KiB {5} [built]
       |    18 modules
[1258] ./node_modules/redux-observable/lib/esm/combineEpics.js + 1 modules 2.54 KiB {5} [built]
       |    2 modules
    + 1390 hidden modules

ERROR in js/vendors~d939e436.bundle.js from UglifyJs
Unexpected token: operator «>» [js/vendors~d939e436.bundle.js:11188,17]
Child html-webpack-plugin for "index.html":
     1 asset
    Entrypoint undefined = index.html
    [0] ./node_modules/html-webpack-plugin/lib/loader.js!./src/index.html 495 bytes {0} [built]
    [2] (webpack)/buildin/global.js 472 bytes {0} [built]
    [3] (webpack)/buildin/module.js 497 bytes {0} [built]
        + 1 hidden module
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I am using UglifyJs

And here is my webpack.config.js plugins section

const UglifyJsPlugin = require("uglifyjs-webpack-plugin")
...
[
    new UglifyJsPlugin(),
]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
plouccommented, May 28, 2019

UglifyJS does not support es6, and d3 now provide packages targetting modern browsers. There was an es6 version of uglify uglify-es, but unfortunately it has been abandoned. As @mdchristians suggested, you could use terser-webpack-plugin.

1reaction
Chedvakacommented, May 26, 2019

Hey,

I have the same issue,

@plouc maybe you will be able to help?

my trace: ERROR in 0.bundle-7ff0c882c735878387cb.js from UglifyJs Unexpected token: keyword (const) [./node_modules/d3-scale/src/ordinal.js:23,0][0.bundle-7ff0c882c735878387cb.js:52010,9] Child extract-text-webpack-plugin node_modules/extract-text-webpack-plugin/dist node_modules/css-loader/index.js??ref--4-2!node_modules/normalize.css/normalize.css: 2 modules Child extract-text-webpack-plugin node_modules/extract-text-webpack-plugin/dist node_modules/css-loader/index.js??ref--5-2!node_modules/@checkmarx/cx-ui/dist/index.css: 2 modules Child extract-text-webpack-plugin node_modules/extract-text-webpack-plugin/dist node_modules/css-loader/index.js?camelCase&modules&sourceMap&importLoaders=1&localIdentName=[local]___[hash:base64:5]!node_modules/resolve-url-loader/index.js?sourceMap!node_modules/sass-loader/lib/loader.js?sourceMap!src/styles/fonts.scss: Asset Size Chunks Chunk Names 3f68500b267c20051088bcc0698af773.ttf 163 kB [emitted] 893fe14628bd7ac498d550e96367e1be.ttf 163 kB [emitted] d329cc8b34667f114a95422aaad1b063.ttf 162 kB [emitted] b37d0bb73a2f688ecaee01647f41e3e5.ttf 164 kB [emitted] fe13e4170719c2fc586501e777bde143.ttf 163 kB [emitted] 5b25afa871e1b896011859f8cdf8da74.ttf 166 kB [emitted] ac3f799d5bbaf5196fab15ab8de8431c.ttf 163 kB [emitted] de74c60991cd63c8b922e0e665a39c7a.ttf 161 kB [emitted] 7b5fb88f12bec8143f00e21bc3222124.ttf 162 kB [emitted] 129c5057f4480f9a353e15e1e1e09f9d.ttf 166 kB [emitted] 256aab654d3c4dd0e12fd0a32c7e8aa6.ttf 165 kB [emitted] 1e5737be5c68c15c3a105b2db9a3b67c.ttf 168 kB [emitted] 93f3386f24129c61174ea97ddd2f04aa.ttf 66.1 kB [emitted] 44b8cda8a2bf778530bab7ceb048c190.woff2 40 kB [emitted] b4cdec736ef6785e0c2caa392a886eb8.woff 56.8 kB [emitted] bfece6d8c1ec4da6086bc2ace36d5ba9.woff 20.9 kB [emitted] ad1867c1adc22645240b3fd33a205f9e.woff2 14.8 kB [emitted] 90327f5ac43d0fbc708f3653ffc0a043.woff 67.5 kB [emitted] 5ef05461d1158f05fa25662bbd968005.woff2 50.1 kB [emitted] a0a97c4ff2a3a9c40a98b78991c47ede.woff 30.3 kB [emitted] [0] ./node_modules/css-loader?camelCase&modules&sourceMap&importLoaders=1&localIdentName=[local]___[hash:base64:5]!./node_modules/resolve-url-loader?sourceMap!./node_modules/sass-loader/lib/loader.js?sourceMap!./src/styles/fonts.scss 9.87 kB {0} [built] [3] ./src/styles/vendors/fonts/Roboto-Black.ttf 82 bytes {0} [built] [4] ./src/styles/vendors/fonts/Roboto-BlackItalic.ttf 82 bytes {0} [built] [5] ./src/styles/vendors/fonts/Roboto-Bold.ttf 82 bytes {0} [built] [6] ./src/styles/vendors/fonts/Roboto-BoldItalic.ttf 82 bytes {0} [built] [7] ./src/styles/vendors/fonts/Roboto-Medium.ttf 82 bytes {0} [built] [8] ./src/styles/vendors/fonts/Roboto-MediumItalic.ttf 82 bytes {0} [built] [9] ./src/styles/vendors/fonts/Roboto-Regular.ttf 82 bytes {0} [built] [10] ./src/styles/vendors/fonts/Roboto-Italic.ttf 82 bytes {0} [built] [12] ./src/styles/vendors/fonts/Roboto-LightItalic.ttf 82 bytes {0} [built] [13] ./src/styles/vendors/fonts/Roboto-Thin.ttf 82 bytes {0} [built] [14] ./src/styles/vendors/fonts/Roboto-ThinItalic.ttf 82 bytes {0} [built] [15] ./src/styles/vendors/fonts/Blogger_Sans-Bold-webfont.ttf 82 bytes {0} [built] [16] ./src/styles/vendors/fonts/axiformaBold/axiforma-medium.woff2 84 bytes {0} [built] [22] ./src/styles/vendors/fonts/gothamBook.woff 83 bytes {0} [built] + 8 hidden modules Child html-webpack-plugin for "index.html":

my UglifyJsPlugin in webpack:

new webpack.optimize.UglifyJsPlugin({ sourceMap: true, compress: { warnings: false, screw_ie8: true, drop_console: true, drop_debugger: true } }),

thanks a lot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gulp - events error with gulp-uglify - Stack Overflow
As the error messages seem to be related to uglify-js , I tried to comment out the uglify() call in the scripts task...
Read more >
uglify-js - npm
JavaScript parser, mangler/compressor and beautifier toolkit. Latest version: 3.17.4, last published: 2 months ago. Start using uglify-js in ...
Read more >
Getting an uglify error when trying to run gulp --production
Hey everyone, I have a project that's working perfectly fine when I run gulp on it in normally in dev but as soon...
Read more >
uglify-js - NPM Package Overview - Socket.dev
Start using Socket to analyze uglify-js and its 0 dependencies to secure ... var result = UglifyJS.minify(code); console.log(result.error); ...
Read more >
Uglify-js errors on MDB.JS - Material Design for Bootstrap
I did some digging and found that the three dots ... is causing the error because it seems not to be JavaScript (ECMAScript...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found