babel-plugin-rewire
babel-plugin-rewire copied to clipboard
^1.1.1 fails to transpile with webpack ^3.5.4
Fails to tranpile with webpack 2 and Karma.
[email protected] , [email protected], [email protected]
Property local of ImportDefaultSpecifier expected node to be of a type ["Identifier"] but instead got "CallExpression"
error on all imported modules
karma.config.js
....
module : {
noParse : [
/\/sinon\.js/
],
rules : webpackConfig.module.rules.concat([
{
test : /sinon(\\|\/)pkg(\\|\/)sinon\.js/,
loader : 'imports-loader?define=>false,require=>false'
},
{
test : /\.(js|jsx)$/,
exclude : [
/node_modules/,
/lib/
],
loader : 'babel-loader',
options: {
presets: ['es2015', 'stage-0', 'react', 'airbnb'],
plugins : [
'rewire',
'transform-runtime',
'transform-decorators-legacy',
],
}
},
{
test : /\.(js|jsx)$/,
include: [/lib/],
exclude: [/node_modules/],
loader : 'babel-loader',
options: {
presets: ['es2015', 'stage-0', 'react'],
plugins : [
'rewire',
'istanbul',
'transform-runtime',
'transform-decorators-legacy',
],
}
},
])
},
...
Rolling back to 1.0.0-rc-4 seems to work
I got the same error message. It was because i uesd babel-transform-imports which will change the ImportSeicifier to the importDefaultSpecifier. When i removed babel-transform-imports , it worked well again.