浮声新志

webpack插件篇:ResolverPlugin.FileAppendPlugin详解

用途说明

ResolverPlugin.FileAppendPlugin ()

This plugin will append a path to the module directory to find a match, which can be useful if you have a module which has an incorrect “main” entry in its package.json/bower.json etc (e.g. “main”: “Gruntfile.js”). You can use this plugin as a special case to load the correct file for this module.

webpack.config.js配置

1
2
3
new webpack.ResolverPlugin([
new webpack.ResolverPlugin.FileAppendPlugin(['dist.js'])
])

案例

1
2
3
new webpack.ResolverPlugin([
new webpack.ResolverPlugin.FileAppendPlugin(['/dist/compiled-moduled.js'])
])