Not working with babel-loader ^6.3.0
Closed this issue · 2 comments
I'm not sure if this is a babel-loader issue, or a babel-plugin-rewire issue. My tests that use rewire are all failing when babel-loader v^6.3.0 is installed. I'm getting the error, TopBar being the component that's being tested:
TypeError: undefined is not a constructor (evaluating '_TopBar2.default.__Rewire__')
It works fine with v6.2.7.
Here's my config files, I'm using webpack 2:
.babelrc
{
"presets": [["latest", { "modules": false }], "react", "stage-0"],
"plugins": ["react-hot-loader/babel", "transform-decorators-legacy"],
"env": {
"test": {
"plugins": [
["./babel-plugins/remove-decorators", ["root", "branch"]],
"rewire"
]
}
}
}
package.json
...
"dependencies": {
"axios": "^0.15.2",
"baobab": "^2.4.1",
"baobab-react": "^2.1.2",
"can-use-dom": "^0.1.0",
"classnames": "^2.2.0",
"clipboard": "^1.6.0",
"cookie-cutter": "^0.2.0",
"history": "^4.5.1",
"lodash": "^4.17.4",
"moment": "^2.16.0",
"moment-range": "3.0.1",
"numeral": "^2.0.4",
"react": "^15.4.2",
"react-bootstrap": "^0.30.5",
"react-dom": "^15.4.2",
"react-google-maps": "^4.11.0",
"react-joyride": "git+https://git@github.com/xveganxxxedgex/react-joyride.git",
"react-kendo": "git+https://git@github.com/xveganxxxedgex/react-kendo.git",
"react-router": "^3.0.2",
"react-router-bootstrap": "^0.23.0",
"react-select": "^1.0.0-rc.3",
"react-vendor-prefix": "0.0.1",
"store": "^1.3.20"
},
"devDependencies": {
"autoprefixer": "6.7.2",
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-loader": "6.2.7",
"babel-plugin-rewire": "^1.0.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-polyfill": "^6.22.0",
"babel-preset-latest": "^6.22.0",
"babel-preset-react": "^6.22.0",
"babel-preset-stage-0": "^6.22.0",
"core-js": "^2.4.1",
"css-loader": "^0.26.0",
"eslint": "^3.15.0",
"eslint-plugin-jasmine": "^2.2.0",
"eslint-plugin-react": "^6.9.0",
"extract-text-webpack-plugin": "^2.0.0-rc.3",
"file-loader": "^0.10.0",
"html-webpack-plugin": "^2.28.0",
"isparta": "^4.0.0",
"istanbul": "^0.4.5",
"jasmine": "^2.5.3",
"jasmine-core": "^2.5.2",
"karma": "^1.4.1",
"karma-babel-preprocessor": "^6.0.1",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.0",
"karma-coverage": "^1.0.0",
"karma-jasmine": "^1.0.2",
"karma-phantomjs-launcher": "^1.0.2",
"karma-phantomjs-shim": "^1.2.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.26",
"karma-webpack": "^2.0.2",
"less": "^2.5.3",
"less-loader": "^2.2.2",
"node-libs-browser": "^2.0.0",
"phantomjs-prebuilt": "^2.1.13",
"postcss-loader": "^1.2.2",
"react-addons-perf": "^15.4.2",
"react-addons-test-utils": "^15.4.2",
"react-hot-loader": "^3.0.0-beta.6",
"rewire": "^2.5.2",
"rewire-webpack": "git+https://git@github.com/RSO/rewire-webpack.git#webpack2",
"style-loader": "^0.13.0",
"url-loader": "^0.5.7",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.3.0"
}
webpack rule
{
test: /\.jsx?$/,
exclude: [/node_modules/],
loaders: ['babel-loader']
},
If this is indeed a babel-plugin-rewire issue, let me know if there was something I overlooked for these recent changes, or if there's anything else I can provide to debug. Thank you!
@xveganxxxedgex sorry for the late replay. Is this still an issue for you. If this is the case could you please provide a minimal project reproducing your issue?
@speedskater This looks to be fixed with v7.0 - thanks!