jest-webpack-alias
jest-webpack-alias copied to clipboard
Error when webpack.config.js exports a function
When webpack.config.js
exports a function
, jest-webpack-alias throws the following error:
● Test suite failed to run
Missing setting "resolve.modules" (webpack v2) or "resolve.root" (webpack v1) in /Users/davidcalhoun/Sites/web/gn-web/webpack.config.js
at Object.read (node_modules/jest-webpack-alias/lib/webpackInfo.js:38:11)
at ensureWebpackInfo (node_modules/jest-webpack-alias/lib/preprocessor.js:26:33)
at Object.process (node_modules/jest-webpack-alias/lib/preprocessor.js:165:3)
at Object.process (test/preprocessor.js:9:45)
The reason I am attempting to export a function
is to setup environment-specific configs utilizing webpack-merge. Is it possible to support exporting a function
?
My issues appear to be similar to #15.
The main question would be: what arguments, if any, should we pass to the function in order to execute it? The webpack docs seem a bit ambiguous on this point: they pass { env: env }
but then have just (env)
in the signature, and then never even use the variable they pass in. Once that's settled, it's easy enough to support.
For posterity's sake, I ended up removing almost all of my Webpack aliases and thus do not need this library to support Jest.
Thank you for considering adding this, but I will no longer need its support. Feel free to close this issue, if you'd like. Thank you for open-sourcing this helpful library! 😄