Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MadLittleMods/b2ac38c76c0472eb738d3a6b3ed71d3d to your computer and use it in GitHub Desktop.
Save MadLittleMods/b2ac38c76c0472eb738d3a6b3ed71d3d to your computer and use it in GitHub Desktop.
webpack ContextReplacementPlugin -> Cannot read property 'contextModuleFactory' of undefined

Thanks to https://tgarchive.ru/group/webpack_ru/2018-03-21/

I solved this by making sure only webpack v4 was in my dependencies (check package-lock.json). Before I had mixed webpack v1 and v4 and had this error when I was upgrading webpack, https://gitlab.com/gitlab-org/gitter/webapp/issues/2078

TypeError: Cannot read property 'contextModuleFactory' of undefined
    at ContextReplacementPlugin.apply (webapp\node_modules\webpack\lib\ContextReplacementPlugin.js:59:18)
    at Compiler.apply (webapp\node_modules\webpack-stream\node_modules\tapable\lib\Tapable.js:164:16)
    at WebpackOptionsApply.process (webapp\node_modules\webpack-stream\node_modules\webpack\lib\WebpackOptionsApply.js:62:18)
    at webpack (webapp\node_modules\webpack-stream\node_modules\webpack\lib\webpack.js:22:48)
    at Stream.<anonymous> (webapp\node_modules\webpack-stream\index.js:131:20)
    at _end (webapp\node_modules\through\index.js:65:9)
    at Stream.stream.end (webapp\node_modules\through\index.js:74:5)
    at module.exports (webapp\node_modules\webpack-stream\index.js:200:12)
    at Gulp.<anonymous> (webapp\build-scripts\gulpfile-clientapp.js:35:7)
    at module.exports (webapp\node_modules\orchestrator\lib\runTask.js:34:7)
    at Gulp.Orchestrator._runTask (webapp\node_modules\orchestrator\index.js:273:3)
    at Gulp.Orchestrator._runStep (webapp\node_modules\orchestrator\index.js:214:10)
    at webapp\node_modules\orchestrator\index.js:279:18
    at finish (webapp\node_modules\orchestrator\lib\runTask.js:21:8)
    at webapp\node_modules\orchestrator\lib\runTask.js:52:4
    at f (webapp\node_modules\end-of-stream\node_modules\once\once.js:17:25)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment