new webpack.NormalModuleReplacementPlugin(resourceRegExp, newResource)
Replace resources that matches resourceRegExp with newResource. If newResource is relative, it is resolve relative to the previous resource. If newResource is a function, it is expected to overwrite the ‘request’ attribute of the supplied object.
ContextReplacementPlugin
1 2 3 4 5 6
new webpack.ContextReplacementPlugin( resourceRegExp, [newContentResource], [newContentRecursive], [newContentRegExp] )
IgnorePlugin
1
new webpack.IgnorePlugin(requestRegExp, [contextRegExp])
不要为匹配的正则生成模块。
requestRegExp 正则用于测试需求
contextRegExp(可选) 正则用于测试上下文(目录)
PrefetchPlugin
1
new webpack.PrefetchPlugin([context], request)
A request for a normal module, which is resolved and built even before a require to it occurs. This can boost performance. Try to profile the build first to determine clever prefetching points.
new webpack.ResolverPlugin( [ new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin('bower.json', [ 'main' ]) ], ['normal', 'loader'] )
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. Example: 举例:
1 2 3
new webpack.ResolverPlugin([ new webpack.ResolverPlugin.FileAppendPlugin(['/dist/compiled-moduled.js']) ])