https://github.com/aduth/resolve-entry-modules-webpack-plugin
Webpack plugin for considering each entry's enclosing directory as a resolve root
https://github.com/aduth/resolve-entry-modules-webpack-plugin
Last synced: about 1 year ago
JSON representation
Webpack plugin for considering each entry's enclosing directory as a resolve root
- Host: GitHub
- URL: https://github.com/aduth/resolve-entry-modules-webpack-plugin
- Owner: aduth
- License: mit
- Created: 2017-04-10T20:36:38.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-05-30T00:40:53.000Z (about 8 years ago)
- Last Synced: 2025-02-26T13:52:52.848Z (over 1 year ago)
- Language: JavaScript
- Size: 101 KB
- Stars: 6
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 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:
```text
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):
```js
var a = require( 'a' );
```
To enable this, we can simply include `ResolveEntryModulesPlugin` as a plugin in our Webpack configuration:
```js
// 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](./LICENSE.md).