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.

ant pro (roadhog) yarn build error: Failed to minify the bundle. Error:from UglifyJs Unexpected token: name (InvalidFormatError)

See original GitHub issue

As far as i understood @sorrycc https://github.com/sorrycc/blog/issues/68 i have edited my .webpackrc.js file:

added es5ImcompatibleVersions: true,

const path = require('path');

export default {
  entry: 'src/index.js',
  es5ImcompatibleVersions: true,
  extraBabelPlugins: [
    ['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }],
  ],
  env: {
    development: {
      extraBabelPlugins: ['dva-hmr'],
    },
  },
  alias: {
    'components': path.resolve(__dirname, 'src/components/'),
  },
  ignoreMomentLocale: true,
  theme: './src/theme.js',
  html: {
    template: './src/index.ejs',
  },
  disableDynamicImport: true,
  publicPath: '/',
  hash: true,
};

After updating webpackrc.js file , deleted Node Modules folder, reinstalled node_modules and yarn cache clean && yarn build

Package.json file:

{
  "name": "Something",
  "version": "1.1.0",
  "description": "some description",
  "private": true,
  "scripts": {
    "start": "cross-env ESLINT=none roadhog dev",
    "start:no-proxy": "cross-env NO_PROXY=true ESLINT=none roadhog dev",
    "build": "cross-env ESLINT=none roadhog build",
    "site": "roadhog-api-doc static && gh-pages -d dist",
    "analyze": "cross-env ANALYZE=true roadhog build",
    "lint:style": "stylelint \"src/**/*.less\" --syntax less",
    "lint": "eslint --ext .js src mock tests && npm run lint:style",
    "lint:fix": "eslint --fix --ext .js src mock tests && npm run lint:style",
    "lint-staged": "lint-staged",
    "lint-staged:js": "eslint --ext .js",
    "test": "roadhog test",
    "test:component": "roadhog test ./src/components",
    "test:all": "node ./tests/run-tests.js",
    "storybook": "start-storybook -p 6006",
    "build-storybook": "build-storybook"
  },
  "dependencies": {
    "@antv/data-set": "^0.8.0",
    "@babel/polyfill": "^7.0.0",
    "@fortawesome/fontawesome-svg-core": "^1.2.14",
    "@fortawesome/pro-light-svg-icons": "^5.7.1",
    "@fortawesome/pro-regular-svg-icons": "^5.7.1",
    "@fortawesome/pro-solid-svg-icons": "^5.7.1",
    "@fortawesome/react-fontawesome": "^0.1.4",
    "@material-ui/core": "^3.0.1",
    "@material-ui/icons": "^3.0.1",
    "antd": "^3.12.1",
    "babel-runtime": "^6.26.0",
    "bizcharts": "^3.2.2",
    "bizcharts-plugin-slider": "^2.0.7",
    "chart.js": "^2.7.3",
    "classnames": "^2.2.6",
    "cookie-storage": "^3.2.0",
    "date-fns": "2.0.0-alpha.7",
    "dva": "^2.4.0",
    "dva-loading": "^2.0.5",
    "enquire-js": "^0.2.1",
    "express": "^4.16.3",
    "express-favicon": "^2.0.1",
    "express-subdomain": "^1.0.5",
    "formsy-react": "^1.1.4",
    "global": "^4.3.2",
    "jquery": "^3.3.1",
    "keymaster": "^1.6.2",
    "lodash": "^4.17.10",
    "lodash-decorators": "^6.0.0",
    "material-ui-pickers": "^1.0.0-rc.13",
    "moment": "^2.22.2",
    "numeral": "^2.0.6",
    "omit.js": "^1.0.0",
    "path": "^0.12.7",
    "path-to-regexp": "^2.4.0",
    "prismjs": "1.15.0",
    "prop-types": "^15.6.2",
    "qs": "^6.5.2",
    "raw-loader": "^0.5.1",
    "rc-animate": "^2.4.4",
    "rc-drawer-menu": "^1.1.0",
    "react": "^16.6.3",
    "react-chartjs": "^1.2.0",
    "react-chartjs-2": "^2.7.4",
    "react-container-query": "^0.11.0",
    "react-cookie": "^3.0.4",
    "react-document-title": "^2.0.3",
    "react-dom": "^16.6.3",
    "react-fittext": "^1.0.0",
    "react-router-dom": "^4.3.1",
    "rollbar": "^2.4.5",
    "url-polyfill": "^1.0.14",
    "winston": "^3.2.1"
  },
  "devDependencies": {
    "@fortawesome/fontawesome-free": "^5.7.1",
    "@fortawesome/fontawesome-pro": "^5.7.1",
    "@storybook/addon-actions": "^3.4.10",
    "@storybook/addon-links": "^3.4.10",
    "@storybook/addon-notes": "^3.4.10",
    "@storybook/addon-storysource": "^3.4.10",
    "@storybook/addons": "^3.4.10",
    "@storybook/react": "^3.4.10",
    "babel-core": "^6.26.3",
    "babel-eslint": "^9.0.0",
    "babel-plugin-dva-hmr": "^0.4.1",
    "babel-plugin-import": "^1.8.0",
    "babel-plugin-transform-decorators-legacy": "^1.3.5",
    "cross-env": "^5.2.0",
    "cross-port-killer": "^1.0.1",
    "enzyme": "^3.5.0",
    "eslint": "^5.4.0",
    "eslint-config-airbnb": "^17.1.0",
    "eslint-plugin-babel": "^5.1.0",
    "eslint-plugin-compat": "^2.5.1",
    "eslint-plugin-import": "^2.14.0",
    "eslint-plugin-jsx-a11y": "^6.1.1",
    "eslint-plugin-markdown": "^1.0.0-beta.6",
    "eslint-plugin-react": "^7.11.1",
    "gh-pages": "^1.2.0",
    "husky": "^0.14.3",
    "lint-staged": "^7.2.2",
    "mockjs": "^1.0.1-beta3",
    "pro-download": "^1.0.1",
    "redbox-react": "^1.6.0",
    "regenerator-runtime": "^0.12.1",
    "roadhog": "^2.4.5",
    "roadhog-api-doc": "^1.1.2",
    "stylelint": "^9.5.0",
    "stylelint-config-standard": "^18.2.0"
  },
  "resolutions": {
    "recompose": "^0.28.2"
  },
  "optionalDependencies": {
    "puppeteer": "^1.7.0"
  },
  "lint-staged": {
    "**/*.{js,jsx}": [
      "eslint --fix",
      "git add"
    ],
    "**/*.less": "stylelint --syntax less"
  },
  "engines": {
    "node": ">=8.0.0"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 10"
  ]
}
screenshot 2019-03-08 at 1 35 59 pm

Please can anyone help me with this:

If missing something, then guide me or doing it wrong, then correct me.

Thank you

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
sorrycccommented, Mar 11, 2019
2reactions
sorrycccommented, Mar 9, 2019

You need to use COMPRESS=none roadhog build to find out which dependency library is causing the problem first, then make a PR to add it to es5-imcompatible-versions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Build Failed To Minify The Bundle. Error From Uglifyjs
ant pro roadhog yarn build error : Failed to minify the bundle. Error:from UglifyJs Unexpected token: name InvalidFormatError.
Read more >
Untitled
Mar 08, 2019 · ant pro (roadhog) yarn build error: Failed to minify the bundle. Error:from UglifyJs Unexpected token: name (InvalidFormatError) · Issue ......
Read more >
Untitled
The build is minified and the filenames include the hashes. Your app is ready to ... 2019 · ant pro (roadhog) yarn build...
Read more >
Failed to minify the bundle - gluten-ei-milch-nussfrei
... rent in omaha nebraska ant pro (roadhog) yarn build error: Failed to minify the bundle. Error:from UglifyJs Unexpected token: name (InvalidFormatError) ...
Read more >
Untitled
... virage 700ant pro (roadhog) yarn build error: Failed to minify the bundle. Error:from UglifyJs Unexpected token: name (InvalidFormatError) · Issue #3697 ......
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