Open joyfulelement opened 9 years ago
+1
Having exact same issue but with Mocha.
+1 Mocha
Has anyone seen any progress on this? I'm having the same issue, using mocha.
1+ Mocha
I'm having a near identical problem, the output is:
Module not found: Error: Cannot resolve module 'module' in ...blah...blah.../node_modules/prunk
Isn't the plugin meant to go in the webpack config, rather than the karma config?
I'm having the same issue. Are there're any thoughts on how to make possible bundling tests with rewire for test purposes?
I ended up using this instead: https://github.com/speedskater/babel-plugin-rewire
This is a late update, but for anyone still encountering this problem: note that the plugin has to be defined as a webpack plugin, not as a Karma plugin!
It should look similar to this:
// karma.conf.js
const RewirePlugin = require('rewire-webpack');
module.exports = function (config) {
config.set({
...
webpack: {
...
plugins: [ new RewirePlugin() ]
}
});
}
Note that since rewire-webpack
unfortunately doesn't have webpack 4 support, you will still get errors like this:
Cannot read property 'plugin' of undefined
(node:9306) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
To solve this, you can use my fork rensbaardman/rewire-webpack-plugin, which adds webpack 4 support.
Hi:
I'm trying to put together a react web app with Webpack + Karma that runs the Jasmine unit test spec with rewire-webpack. Whenever I tried running the Karma, the following error occurred:
The following is the configuration for karma.conf.js:
Currently using babel and babel loader version > 6 as defined in package.json
Does anyone happen to know if such configuration with the version lineup here with babel + webpack would work with rewire-webpack?
Many Thanks!