I'm submitting a bug report
Webpack Version:
2.3.3
Babel Core Version:
6.24.0
Babel Loader Version:
6.4.1
Please tell us about your environment:
OSX 10.x
Current behavior:
I want to load a few es6 node_modules through babel-loader to transpile them. They're coming into my bundle as native es6, which obviously is a problem for my browser builds.
My rule looks like:
{
test: /\.jsx?$/,
exclude: /node_modules\/(?!(aggregate\-error|clean\-stack|is\-reachable|p\-any|p\-some)\/).*/,
use: [
'babel-loader',
],
},
When building my webpack bundle, I get:
ERROR in ./~/is-reachable/browser.js
Module build failed: Error: EISDIR: illegal operation on a directory, read
at Error (native)
at Object.fs.readSync (fs.js:732:19)
at tryReadSync (fs.js:487:20)
at Object.fs.readFileSync (fs.js:535:19)
at ConfigChainBuilder.addConfig (/Users/sbussetti/src/popcorn-pass-pos/node_modules/babel-core/lib/transformation/file/options/build-config-chain.js:146:32)
at ConfigChainBuilder.findConfigs (/Users/sbussetti/src/popcorn-pass-pos/node_modules/babel-core/lib/transformation/file/options/build-config-chain.js:102:30)
at buildConfigChain (/Users/sbussetti/src/popcorn-pass-pos/node_modules/babel-core/lib/transformation/file/options/build-config-chain.js:61:13)
at OptionManager.init (/Users/sbussetti/src/popcorn-pass-pos/node_modules/babel-core/lib/transformation/file/options/option-manager.js:354:58)
at File.initOptions (/Users/sbussetti/src/popcorn-pass-pos/node_modules/babel-core/lib/transformation/file/index.js:212:65)
at new File (/Users/sbussetti/src/popcorn-pass-pos/node_modules/babel-core/lib/transformation/file/index.js:135:24)
at Pipeline.transform (/Users/sbussetti/src/popcorn-pass-pos/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at transpile (/Users/sbussetti/src/popcorn-pass-pos/node_modules/babel-loader/lib/index.js:46:20)
at Object.module.exports (/Users/sbussetti/src/popcorn-pass-pos/node_modules/babel-loader/lib/index.js:163:20)
@ ./src/actions/meta.js 4:0-39
@ ./src/containers/Settings.jsx
@ ./src/apps/Attended/Routes.jsx
@ ./src/apps/Attended/App.jsx
@ ./src/apps/Attended/Client.jsx
@ multi ./src/apps/Attended/Client.jsx
If I totally exclude node_modules, everything builds fine, so it's something about trying to allow some node_modules to be transpiled
Expected/desired behavior:
Being able to run some node modules through babel-loader
I reached out for support on Slack, and was assisted by @loganfsmyth in discovering that the issue was this package: https://www.npmjs.com/package/package-json Whose namespace is, in fact, package.json. Apparently the above trace is created due to finding a directory named .babelrc, .babelrc.js or package.json, which, in this case there was.
So, dropping that package from my project (I could work without it) immediately resolved my issue, but the error message was pretty unhelpful.
I should add, no matter what module I try to run through the loader, I get this issue. It just happens that is-reachable trips it first in the case above.
Fixed in next release
If you're comming from react native error on Metro bundler:
watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/haste-map-react-native-packager-*
rm -rf node_modules/
then yarn or npm i
Imho package-json should be renamed or banned in npm. The 500k downloads are most likely from a lot of people accidently executing 'npm install package.json' instead of 'npm install'. After this, everything keeps on breaking with above EISDIR error until you manually remove the package-json entry in your package.json...
Most helpful comment
Imho package-json should be renamed or banned in npm. The 500k downloads are most likely from a lot of people accidently executing 'npm install package.json' instead of 'npm install'. After this, everything keeps on breaking with above EISDIR error until you manually remove the package-json entry in your package.json...