null-loader

null-loader

一个加载器,返回一个空模块。

安装

npm i null-loader --save

例子

此加载程序的一个用途是使依赖项导入的模块静音。比如说,例如,您的项目依赖于导入您不需要的 polyfill 的ES6库,因此删除它将不会导致功能损失。测试 polyfill 的路径,它不会包含在您的包中:

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