Skip to content

A Webpack plugin forked from create-react-app that prevents users from importing from outside of src/ and node_modules/ directory

License

Notifications You must be signed in to change notification settings

ktalebian/module-scope-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@k88/module-scope-plugin

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.

Installation

Install using

npm install @k88/module-scope-plugin

Usage

Add this plugin to the resolve key of Webpack:

const ModuleScopePlugin = require('@k88/ModuleScopePlugin');
module.exports = {
  ...webpackConfig,
  resolve: {
      /* other resolve configs */
      plugins: [
          new ModuleScopePlugin(APP_SOURCE_PATH, [ OTHER_PATHS, PACKAGE_JSON_PATH ]),
      ],
  },
}

About

A Webpack plugin forked from create-react-app that prevents users from importing from outside of src/ and node_modules/ directory

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published