babel-plugin-rewire icon indicating copy to clipboard operation
babel-plugin-rewire copied to clipboard

^1.1.1 fails to transpile with webpack ^3.5.4

Open Steffan-Ennis opened this issue 7 years ago • 1 comments

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

Steffan-Ennis avatar Sep 20 '17 01:09 Steffan-Ennis

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.

cuijing1031 avatar Nov 06 '17 09:11 cuijing1031