webpack 4.45.0 falls to build with ModuleScopePlugin
See original GitHub issueBug report
What is the current behavior?
In webpack v4.45.0,When I build a project with ModuleScopePlugin,it throws an error:ModuleNotFoundError: Module not found: Error: You attempted to import /Users/workspace/node_modules/_events@3.2.0@events/events.js which falls outside of the project src/ directory. Relative imports outside of src/ are not supported. You can either move it inside src/, or add a symlink to it from project's node_modules/.
This is error stack:
at factory.create (/Users/worspace/node_modules/_webpack@4.45.0@webpack/lib/Compilation.js:925:10)
at factory (/Users/worspace/node_modules/_webpack@4.45.0@webpack/lib/NormalModuleFactory.js:401:22)
at resolver (/Users/worspace/node_modules/_webpack@4.45.0@webpack/lib/NormalModuleFactory.js:130:21)
at asyncLib.parallel (/Users/worspace/node_modules/_webpack@4.45.0@webpack/lib/NormalModuleFactory.js:224:22)
at /Users/worspace/node_modules/_neo-async@2.6.2@neo-async/async.js:2830:7
at /Users/worspace/node_modules/_neo-async@2.6.2@neo-async/async.js:6877:13
But it works well in webpack v4.44.2.
If the current behavior is a bug, please provide the steps to reproduce. I build my app with following config:
// webpack.prod.js
resolve: {
plugins: [
new ModuleScopePlugin(join(process.cwd(), 'src'), [join(process.cwd(), 'package.json')]),
],
},
What is the expected behavior? It builds successfully.
Other relevant information: webpack version: 4.45.0 Node.js version: 10.23.0 Operating System: macOS Big Sur 11.1 Additional tools:
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Fixed, please update to latest version (v4)
Ok I think I know the issue… Working on a fix