2.1.0 • Published 9 months ago
@moodia/override-resolver v2.1.0
README
This is a Webpack plugin that allows you to override module imports based on file paths. It's called OverrideResolver and you can use it by importing the necessary packages and creating a new instance of the class. Here's an example of how to use it:
const OverrideResolver = require('path/to/OverrideResolver');
const overrideResolver = new OverrideResolver(
// An array of base source roots to search for module imports
['./src'],
// An array of override source roots to search for overrides
['./src/overrides'],
// An array of directory names that can be overridden
['myDirectory'],
// An array of directories to exclude from the override
['node_modules'],
// An object that maps a module name to an override file path
{ 'myModule': './src/overrides/myModule.js' },
// An array of objects that specify import guard rules
[
{
// The directory to guard
ward: './src/myDirectory',
// An array of whitelisted directories that can be imported
whitelist: ['./src/allowedDirectory']
}
]
);
module.exports = {
// ...
resolve: {
plugins: [overrideResolver]
}
// ...
}
Here's what each argument to the OverrideResolver constructor does:
baseSourceRoots: An array of directory names to search for module imports.
overrideSourceRoots: An array of directory names to search for overrides.
overridableDirectories: An array of directory names that can be overridden.
excludedRequestDirectories: An array of directories to exclude from the override.
additionalDependencies: An object that maps a module name to an override file path.
importGuard: An array of objects that specify import guard rules.
After creating an instance of OverrideResolver, you can add it to your webpack config by including it in the resolve.plugins array.
2.1.0
9 months ago
2.0.0
9 months ago
1.6.4
1 year ago
1.6.3
1 year ago
1.6.2
1 year ago
1.6.1
3 years ago
1.6.0
3 years ago
1.5.3
3 years ago
1.5.2
3 years ago
1.5.1
3 years ago
1.5.0
3 years ago
1.4.0
4 years ago
1.3.3
4 years ago
1.3.2
4 years ago
1.3.1
4 years ago
1.3.0
4 years ago
1.2.0
4 years ago
1.1.3
4 years ago
1.1.2
5 years ago
1.1.1
5 years ago
1.1.0
5 years ago
1.0.0
5 years ago