赞助 webpack,同时从官方商店购买衣服 所有收益将转到我们的 open collective

null-loader

A loader that returns an empty module.

安装

npm i null-loader --save

示例

One use for this loader is to silence modules imported by a dependency. Say, for example, your project relies on an ES6 library that imports a polyfill you don't need, so removing it will cause no loss in functionality. Test for the path to the polyfill and it won't be included in your bundle:

const path = require('path');

module.exports = {
  module: {
    rules: [
      {
        test: path.resolve(__dirname, 'node_modules/library/polyfill.js'),
        use: 'null-loader'
      }
    ]
  }
}

维护人员


Juho Vepsäläinen


Joshua Wiens


Kees Kluskens


Sean Larkin