babel-plugin-rewire
babel-plugin-rewire copied to clipboard
__$$GLOBAL_REWIRE_REGISTRY__ is not defined
Im getting this error with the base install of this plugin. Anyone have any thoughts on a solution
Full Error
ReferenceError: __$$GLOBAL_REWIRE_REGISTRY__ is not defined
at _getRewireRegistry__ (C:\Dev\Proj\.tmp\mocha-webpack\1508343600360\bundle.js:133:9)
at _getRewiredData__ (C:\Dev\Proj\.tmp\mocha-webpack\1508343600360\bundle.js:139:17)
at _assign__ (C:\Dev\Proj\.tmp\mocha-webpack\1508343600360\bundle.js:208:19)
at Object.<anonymous> (C:\Dev\Proj\node_modules\webpack\buildin\global.js:4:1)
at Object.<anonymous> (C:\Dev\Proj\.tmp\mocha-webpack\1508343600360\bundle.js:317:30)
at __webpack_require__ (C:\Dev\Proj\.tmp\mocha-webpack\1508343600360\webpack\bootstrap 657297bf9bae482caeef:19:1)
at Object.defineProperty.value (C:\Dev\Proj\.tmp\mocha-webpack\1508343600360\bundle.js:13625:44)
at __webpack_require__ (C:\Dev\Proj\.tmp\mocha-webpack\1508343600360\webpack\bootstrap 657297bf9bae482caeef:19:1)
at _typeof (C:\Dev\Proj\.tmp\mocha-webpack\1508343600360\webpack\bootstrap 657297bf9bae482caeef:62:1)
at Object.<anonymous> (C:\Dev\Proj\.tmp\mocha-webpack\1508343600360\bundle.js:66:10)
at Module._compile (module.js:570:32)
at Object._module2.default._extensions.(anonymous function) [as .js] (C:\Dev\Proj\node_modules\mocha-webpack\lib\util\registerRequireHook.js:147:12)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at C:\Dev\Proj\node_modules\mocha\lib\mocha.js:231:27
at Array.forEach (native)
at Mocha.loadFiles (C:\Dev\Proj\node_modules\mocha\lib\mocha.js:228:14)
at Mocha.run (C:\Dev\Proj\node_modules\mocha\lib\mocha.js:514:10)
at runMocha (C:\Dev\Proj\node_modules\mocha-webpack\lib\runner\TestRunner.js:244:35)
at C:\Dev\Proj\node_modules\mocha-webpack\lib\runner\TestRunner.js:300:13
at Compiler.<anonymous> (C:\Dev\Proj\node_modules\mocha-webpack\lib\webpack\compiler\registerReadyCallback.js:26:7)
at Compiler.applyPlugins (C:\Dev\Proj\node_modules\tapable\lib\Tapable.js:61:14)
at Watching._done (C:\Dev\Proj\node_modules\webpack\lib\Compiler.js:104:17)
at compiler.emitRecords.err (C:\Dev\Proj\node_modules\webpack\lib\Compiler.js:78:19)
at Compiler.emitRecords (C:\Dev\Proj\node_modules\webpack\lib\Compiler.js:375:38)
at compiler.emitAssets.err (C:\Dev\Proj\node_modules\webpack\lib\Compiler.js:61:20)
at applyPluginsAsyncSeries1.err (C:\Dev\Proj\node_modules\webpack\lib\Compiler.js:368:12)
at next (C:\Dev\Proj\node_modules\tapable\lib\Tapable.js:218:11)
at Compiler.compiler.plugin (C:\Dev\Proj\node_modules\webpack\lib\performance\SizeLimitsPlugin.js:99:4)
at Compiler.applyPluginsAsyncSeries1 (C:\Dev\Proj\node_modules\tapable\lib\Tapable.js:222:13)
at Compiler.afterEmit (C:\Dev\Proj\node_modules\webpack\lib\Compiler.js:365:9)
at require.forEach.err (C:\Dev\Proj\node_modules\webpack\lib\Compiler.js:354:15)
at C:\Dev\Proj\node_modules\async\dist\async.js:421:16
at iteratorCallback (C:\Dev\Proj\node_modules\async\dist\async.js:998:13)
at C:\Dev\Proj\node_modules\async\dist\async.js:906:16
at writeOut (C:\Dev\Proj\node_modules\webpack\lib\Compiler.js:333:14)
at require.forEach (C:\Dev\Proj\node_modules\webpack\lib\Compiler.js:349:12)
at C:\Dev\Proj\node_modules\async\dist\async.js:3083:16
at eachOfArrayLike (C:\Dev\Proj\node_modules\async\dist\async.js:1003:9)
at eachOf (C:\Dev\Proj\node_modules\async\dist\async.js:1051:5)
at Object.eachLimit (C:\Dev\Proj\node_modules\async\dist\async.js:3145:5)
at emitFiles (C:\Dev\Proj\node_modules\webpack\lib\Compiler.js:319:21)
at Immediate.<anonymous> (C:\Dev\Proj\node_modules\memory-fs\lib\MemoryFileSystem.js:288:4)
at runCallback (timers.js:672:20)
at tryOnImmediate (timers.js:645:5)
at processImmediate [as _immediateCallback] (timers.js:617:5)
Versions
"avoriaz": "4.2.0",
"babel-core": "6.26.0",
"babel-eslint": "8.0.1",
"babel-loader": "7.1.2",
"babel-plugin-rewire": "^1.1.0",
"babel-preset-es2015": "6.24.1",
"chai": "4.1.2",
"cross-env": "3.0.0",
"css-loader": "0.25.0",
"date-fns": "1.28.5",
"eslint": "4.8.0",
"eslint-config-standard": "10.2.1",
"eslint-friendly-formatter": "3.0.0",
"eslint-loader": "1.9.0",
"eslint-plugin-html": "3.2.2",
"eslint-plugin-import": "2.7.0",
"eslint-plugin-node": "5.2.0",
"eslint-plugin-promise": "3.5.0",
"eslint-plugin-standard": "3.0.1",
"eslint-plugin-vue": "3.13.1",
"extract-text-webpack-plugin": "3.0.1",
"file-loader": "1.1.5",
"istanbul-instrumenter-loader": "3.0.0",
"jsdom": "11.2.0",
"jsdom-global": "3.0.2",
"less": "2.7.1",
"less-loader": "4.0.5",
"mocha": "3.5.3",
"mocha-webpack": "1.0.0-rc.1",
"node-inspector": "1.1.1",
"nyc": "11.2.1",
"sinon": "3.3.0",
"style-loader": "0.19.0",
"url-loader": "0.6.2",
"validator": "9.0.0",
"vue-loader": "13.3.0",
"vue-template-compiler": "2.4.4",
"webpack": "3.6.0",
"webpack-dev-server": "2.9.1",
"webpack-node-externals": "1.6.0"
babelrc
{
"presets": [
["es2015",{ "modules": false }]
],
"plugins" :["rewire"]
}
webpack test config
const nodeExternals = require('webpack-node-externals');
const isCoverage = process.env.NODE_ENV === 'coverage';
const path = require('path');
function resolve(dir) {
return path.resolve(__dirname, dir);
}
module.exports = {
devtool: 'source-map',
output: {
// use absolute paths in sourcemaps (important for debugging via IDE)
devtoolModuleFilenameTemplate: '[absolute-resource-path]',
devtoolFallbackModuleFilenameTemplate: '[absolute-resource-path]?[hash]'
},
/*
Use webpack-node-externals to prevent bundling anything referenced in node_modules.
At runtime, these modules can be loaded by Node and therefore do not need to be bundled by Webpack. */
externals: [
nodeExternals({whitelist: [/^vue-awesome/,/^lodash/]})
],
resolve: {
extensions: ['.js', '.vue'],
alias: {
'vue$': 'vue/dist/vue.common.js',
'@': resolve('src')
}
},
module: {
rules: [].concat(
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
js: 'babel-loader?plugins=rewire',
less: 'style-loader!css-loader?sourceMap=true!less-loader?sourceMap=true'
}
}
},
{
test: /\.js$/,
loader: 'babel-loader?plugins=rewire'
},
isCoverage ? {
test: /\.js|\.vue$/,
use: {
loader: 'istanbul-instrumenter-loader',
options: {esModules: true, produceSourceMap: true}
},
enforce: 'post',
exclude: /node_modules|\.spec\.js$/
} : []
)
}
};
Was there ever a fix for this?
not that I saw, I moved on from it at this point and will look to revisit later, ended up changing how we coded modules and classes for now. The activity seems lacking at this point. you would probably be better to clone the banch and adopt your own version that fixes the issues..