-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enhanced-resolve doesn't always have /lib/ModuleAliasPlugin.js #25
Comments
Same problem here. Getting |
For everyone having the same problem: You can use babel and babel-rewire-plugin. It sidesteps the issue (rewire is then handled by babel) and is a nice workaround to get unblocked. |
Can you provide an example :)? |
For what, exactly? Using babel-rewire or for the issue described? |
Well, I'm not sure but I guess a karma / wepack config file example :)? It's just so I understand how you use Babel-rewire as a workaround :)
|
Its nothing special about what I did. I just used a different set of frameworks. Instead of going karma -> webpack -> webpack-rewire -> mocha/chai I now use karma -> webpack -> babel -> babel-plugin-rewire -> mocha/chai You can check out the babel plugin here: https://github.com/speedskater/babel-plugin-rewire |
Sweet, thanks for the help ! I'll be looking into it. The only thing I am worried about when using babel is that I've always used webpack, and I am testing a lib that is packed with it. But I guess for unit testing it doesn't really matter how you pack scripts. I am somehow worried that packing something differently in a testing environment and in a production environment could cause issues :/ |
My setup still uses webpack :) |
For a solution without babel, you can use my fork rensbaardman/rewire-webpack-plugin, which has webpack 4 support. |
I currently have a project with enhanced-resolve v3.4.1 and it doesn't have
/lib/ModuleAliasPlugin.js
; this causesRewirePlugin.js
to fail in line 48.See also: https://github.com/webpack/enhanced-resolve/tree/master/lib
Additionally, in webpack the resolvers are initialised with
null
in the Compiler constructor and you cannot use apply on null: https://github.com/webpack/webpack/blob/master/lib/Compiler.js#L184The text was updated successfully, but these errors were encountered: