Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
babel + core-js + webpack make code support old chrome, many node_modules file raise "export ... was not found" error

I reproduce err in this project

following is my babel.config.js

module.exports = {
    presets: [
        ["@babel/preset-env", {
            "useBuiltIns": "usage",
            "corejs": 3, // or 2,
            "targets": {
                "chrome": "54" // babel is for debug, it make code compatible android webview, so compatible my genymotion android webview is enough
            },
            "exclude": ["@babel/plugin-transform-regenerator", "@babel/plugin-transform-arrow-functions"]
        }],
    ]
}

when npx webpack serve, it raise many similar errs like export 'default' (imported as 'stripAnsi') was not found in './modules/strip-ansi/index.js' (module has no exports)

when babel.config.js set chrome:54, it raise err; when set chrome:74, not err, but I expect all code support chrome 54 and I must use core-js to apply polyfill, so how to fix this bug?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Some deps use module.exports will conflict with babel + corejs, so make babel ignore these deps, and even no babel, most popular deps native support old browser(like react, react-dom use module.exports, they natively support very old browser)

in my case, only little deps cause this err, so i use babel.config.js "exclude" like following:

module.exports = {
    presets: [
        ["@babel/preset-env", {
            "useBuiltIns": "usage",
            "corejs": "3.19.0", // or 2,
            "targets": {
                "android": "54" // babel is for debug, it make code compatible android webview, so compatible my genymotion android webview is enough
            },
            "exclude": ["@babel/plugin-transform-regenerator", "@babel/plugin-transform-arrow-functions"]
        }],
        "@babel/preset-react",
    ],
    exclude: [/node_modules\/react/, /node_modules\/urijs/, /node_modules\/axios/]
}

also, if maybe deps cause this err, use babel.config.js "include" fix it

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!