A Webpack plugin forked from create-react-app that prevents users from importing from outside of src/ and node_modules/ directory. Taken from react-dev-utils, but is published as a standalone plugin and has Typescript definition.
Install using
npm install @k88/module-scope-pluginAdd this plugin to the resolve key of Webpack:
constModuleScopePlugin=require('@k88/ModuleScopePlugin');module.exports={
...webpackConfig,resolve: {/* other resolve configs */plugins: [newModuleScopePlugin(APP_SOURCE_PATH,[OTHER_PATHS,PACKAGE_JSON_PATH]),],},}