• Register
1 vote

Problem :

Currently I am trying to learn the Node, Webpack , Babel. I have recently joined a new project so need to learn these three technologies.

Now I am facing below error while trying to build my project.

“Module build failed (from ./node_modules/babel-loader/lib/index.js)”.

Please find below my development environment for your reference:

Node version: 8.0.0
Npm version: 5.0.0

devDependencies as below:

"devDependencies": {
    "babel-core": "^6.26.3",
    "babel-loader": "^8.0.0",
    "babel-preset-env": "^1.7.0",
    "webpack": "^4.17.1",
    "webpack-dev-server": "^3.1.7"

Please guide me in fixing above error.

8 5 2
3,230 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I am trying to help you with the below solution for your error.

The babel-loader@8.x always uses the Babel 7.x, which is called as @babel/core@^7.0.0, and now it is more important in your case the  @babel/preset-env@7 must replace the babel-preset-env@^1.7.0.

You must make sure to execute below command :

npm install @babel/core @babel/preset-env

You must also  update the Babel config so that you can use @babel/preset-env instead of the  babel-preset-env with something like below example

"presets": [



If this is not helping you then the issue may also be that you may be using the plugins from the Babel 6 on the Babel 7. You may find it very hard to notice if by chance you are using any third-party Babel preset as you may know the versions of a presets may not match with the version of the Babel itself.

8 4
5,680 points

Related questions

0 votes
1 answer 1.9K views
Problem : I am very new to gulp. I am facing following gulp error My gulpfile.js var mygulp = require('gulp'); var mysource = require('vinyl-source-stream'); var mybrowserify = require('browserify'); var mybabelify = require("babelify"); var mywatch = require('gulp ... 'import' and 'export' may appear only with 'sourceType: module' I am unable to understand the error. How can I resolve this error?
asked Jan 28, 2020 jwilliam 3.9k points
0 votes
1 answer 3 views
Problem : failed to load external module babel register
asked 5 days ago Shovo210 3.1k points
0 votes
1 answer 2.2K views
Problem : While I was trying to set up the React within Django project I came across below error ModuleBuildError in Module build failed (from ./node_modules/babel-loader/lib/index.js): SyntaxError: C:\Users\jwilliam\Cebula3\cebula_react\assets\js\index.js: Support for the ... : [ "@babel/plugin-proposal-class-properties" ] } But the above error is still existed, How can I fix the error??
asked Jan 20, 2020 jwilliam 3.9k points
0 votes
1 answer 380 views
Problem : I have the React project using the Webpack and Babel. When I created it on the office computer, my Webpack ran fine. But when I cloned my project onto the personal computer, it gave me below error : ERROR in ./ ... native) at OptionManager.resolvePresets (/Users/alecxe/Desktop/w6d5/minesweeper/node_modules/babel-core/lib/transformation/file/options/option-manager.js:269:20)
asked Jan 7, 2020 alecxe 7.5k points
0 votes
1 answer 11 views
Problem: you may need an appropriate loader to handle this file type
asked Feb 17 Dan phillip 1.9k points
0 votes
1 answer 24 views
Problem: uncaught syntaxerror: cannot use import statement outside a module.
asked Feb 15 Ethan ross 1.8k points
1 vote
1 answer 4 views
Problem: I always get this error message when I run "Ionic start project name": error: cannot find module '../lib/utils/unsupported.js'
asked 6 days ago Sofia Castro 4.2k points
0 votes
1 answer 5 views
Problem Hi Kodlogs communitiy, I am confused about var const and let variables in JavaScript. Could please someone shed some light on it ?
asked Jan 22 alexh 2.5k points
0 votes
2 answers 113 views
Problem : I am using the reactjs. When I run my code below my browser says: Uncaught TypeError: Super expression must either be null or a function, not undefined Any clues at all as to what is wrong with my code? First the line used to compile the code as below : ... var React = require('react'); class HelloMessage extends React.Component {   render() {     return <div>Hello World</div>;   } }
asked Jan 23, 2020 jwilliam 3.9k points
0 votes
1 answer 1K views
Problem : I am using the reactjs. When I try to run my code the browser says as below: Uncaught TypeError: Super expression must either be null or a function, not undefined The line used to compile my code: browserify -t reactify -t babelify examples/temp.jsx -o examples/public ... Component { render() { return <div>Hello World !! </div>; } } Does anyone have any idea on the solution for my issue?
asked Dec 7, 2019 alecxe 7.5k points