I'm submitting a bug report
Webpack Version:
1.15.0
Babel Core Version:
6.26.0
Babel Loader Version:
7.1.2
Please tell us about your environment:
OSX 10.12.6
Current behavior:
I'm getting following error when building with gulp and webpack:
[12:52:08] Using gulpfile gulpfile.js
[12:52:08] Starting 'build'...
[12:52:09] Version: webpack 1.15.0
ERROR in ./src/entry.js
Module build failed: TypeError: fileSystem.statSync is not a function
at module.exports (node_modules/babel-loader/lib/utils/exists.js:7:25)
at find (node_modules/babel-loader/lib/resolve-rc.js:13:9)
at Object.module.exports (node_modules/babel-loader/lib/index.js:113:132)
[12:52:09] Finished 'build' after 1.17 s
Gulp ran 1 task in 1.17 s
Here is my Gulp script:
module.exports = function (gulp, config, plugins) {
return function () {
return gulp.src(config.sources.concat(config.lib))
.pipe(plugins.webpack({
entry: config.entry,
output: {
filename: 'lib.js',
library: 'lib',
libraryTarget: 'var'
},
module: {
loaders: [{
test: /.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015']
}
}]
},
node: {
fs: 'empty'
}
}))
.pipe(gulp.dest(config.dist + 'js/'));
};
};
In version 7.1.1 of babel-loader the problem did not occur. The reason is probably because all errors in exists.js are swallowed in 7.1.1:
try {
exists = fileSystem.statSync(filename).isFile();
} catch (e) {}
When I remove try & catch in 7.1.1, I'm getting the same error as in 7.1.2.
Same on Windows 7 Professional SP1
Confirmed. I'm getting the exact same error.
I am having the same issue.
Webpack Version:
1.14.1
Babel Core Version:
^6.26.0
Babel Loader Version:
^7.1.1
Please tell us about your environment:
Win7x64 SP1
Like the original poster. I uninstalled babel-loader from dependencies. Reinstalled as npm install --save [email protected] and it works now.
Same here, without gulp and running on OSX 10.11.6. Downgraded to [email protected] (arbitrarily) to solve the issue.
Confirmed having the same issue.
Webpack Version:
2.1.0
Babel Core Version:
^6.26.0
Babel Loader Version:
7.1.2
Environment:
Mac OS 10.12.6
Downgrade to 7.1.1 fixed the issue.
I'm having the same issue and I found this.fs does not have statSync
https://github.com/babel/babel-loader/blob/v7.1.2/src/index.js#L114
babel-loader >= 7.0.0 is only for webpack >=2.2.0
For webpack 1.x please use babel-loader 6.x
I have a devDependency with;
"babel-loader": "6.2.4"
"webpack": "1.13.1",
"webpack-dev-server": "1.14.1"
and in dependencies (no webpack):
"babel-loader": "^7.1.1"
Oddly when I removed and added the babel-loader back in dependencies with the 7.1.1 package it all worked again.
BTW, im using the create react app and I was getting this error with npm start.
@dnbr2002 - Your Webpack version is too old. babel-loader needs Webpack 2.x or higher.
@Daniel15 But my webpack version is @2.4.1๏ผwhen i use [email protected] , i got the same question , but [email protected] didn't.....
I got the same question,
I wrap the web source code in docker,
I am sure 5 days ago it still works, but it breaks recent two days,
my package version:
[email protected]
[email protected]
following is the log of docker file
Step 6/9 : RUN /src/node_modules/.bin/gulp build build.index
---> Running in b37e13a8d346
false
[07:38:20] Using gulpfile /src/gulpfile.js
[07:38:20] Starting 'build'...
[07:38:20] Starting 'build.index'...
[07:38:20] Finished 'build.index' after 21 ms
internal/streams/legacy.js:59
throw er; // Unhandled stream error in pipe.
^
Error: ModuleBuildError: Module build failed: TypeError: fileSystem.statSync is not a function
at module.exports (/src/node_modules/babel-loader/lib/utils/exists.js:7:25)
at find (/src/node_modules/babel-loader/lib/resolve-rc.js:13:9)
at Object.module.exports (/src/node_modules/babel-loader/lib/index.js:113:132)
my babel package log
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
my webpack package log
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
โโ [email protected]
My temporarily solution is downgrade babel-loader to 7.1.1
yarn add [email protected] --dev
ๆไน้ๅฐ่ฟ็ง้ฎ้ขไบ,่ฐข่ฐขๆฅผไธ็ๅผๅ ,ๆๆถๆbabel-load้็บงไธบ6.x็ๆฌ,้ฎ้ขๆๆถๅๅถไฝไบ
@JackyTung @danez is right, older version webpack using newer version babel-loader cause this issue.
As @JackyTung mentioned, downgrade the [email protected] works(my webpack version is 1.13.0).
Absolutely, @JackyTung is right, but the workaround is given from the very beginning at the end of the issue description and the explanation was provided by @danez. Just to be neat.
@maurocarrero right! I've changed my last comment.
npm update -g webpack
The vast majority of things in the Node ecosystem aren't meant to be installed globally. If you're using Webpack you should be installing it in your own project with a specific version, which means it will work fine if you install the newest version of it and the newest version of babel-loader. The only reason this issue comes up is that some people are trying to use mismatched versions.
If you're using an old version of webpack, use the old version of babel-loader.
Most helpful comment
My temporarily solution is downgrade babel-loader to 7.1.1