2.0.0 • Published 6 years ago

resolve-entry-modules-webpack-plugin v2.0.0

Weekly downloads
150
License
MIT
Repository
-
Last release
6 years ago

Resolve Entry Modules Webpack Plugin

Webpack plugin for considering each entry's enclosing directory as a resolve root for all imports within occurring in the dependency tree of that entry. It is effectively the same as defining a resolve.modules for each directory of your entry while ensuring that distinct entries cannot import from the others.

Usage

Imagine the following project structure:

project/
├── entry-one/
│   ├── index.js
│   └── a.js
└── entry-two/
    ├── index.js
    └── a.js

For each entry point, we'd like to import a.js directly (without relative paths):

var a = require( 'a' );

To enable this, we can simply include ResolveEntryModulesPlugin as a plugin in our Webpack configuration:

// webpack.config.js
const ResolveEntryModulesPlugin = require( 'resolve-entry-modules-webpack-plugin' );

module.exports = {
	entry: {
		one: './entry-one/index.js',
		two: './entry-two/index.js'
	},
	plugins: [
		new ResolveEntryModulesPlugin()
	]
};

License

Copyright 2018 Andrew Duthie

Released under the MIT License.