Rens Baardman
Rens Baardman
What do you mean with 'both of these variables are available before rewiring'? Looking at the source code of `component.js`, they don't get declared or imported there, so somehow they...
> Hi @rensbaardman, thanks for the answer. > > > Even if in the file you are currently working in, you have declared Element and cash, that doesn't mean rewire...
Alright, but where/how are `Element` and `cash` defined as globals? Because if Jest injects `Element` into your test, then that (probably) doesn't make it global. And `import`ing `cash` also doesn't...
Hmmm... that's interesting. I wouldn't know why calling `rewire()` would undefine global variables. I think I now understand what your problem is 😅 And now I see why it could...
For a solution without babel, you can use my fork [rensbaardman/rewire-webpack-plugin](https://github.com/rensbaardman/rewire-webpack-plugin), which has webpack 4 support.
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...
For webpack 4 support, you can use my fork [rensbaardman/rewire-webpack-plugin](https://github.com/rensbaardman/rewire-webpack-plugin).
Unfortunately, the plugin doesn't have webpack 4 support. Webpack 4 introduced a different plugin API, which you are seeing the errors of. A solution is to use [my fork](https://github.com/rensbaardman/rewire-webpack-plugin) which...