IgnorePlugin

IgnorePlugin

Prevent generation of modules for import or require calls matching the following regular expressions:

  • requestRegExp A RegExp to test the request against.
  • contextRegExp (optional) A RegExp to test the context (directory) against.
new webpack.IgnorePlugin(requestRegExp, [contextRegExp])

The following examples demonstrate a few ways this plugin can be used.

Ignore Moment Locales

As of moment 2.18, all locales are bundled together with the core library (see this GitHub issue). You can use the IgnorePlugin to stop any locale being bundled with moment:

new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)

© JS Foundation and other contributors
Licensed under the Creative Commons Attribution License 4.0.
https://webpack.js.org/plugins/ignore-plugin

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部