Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

null-loader

webpack-contrib3.7mMIT4.0.1

A webpack loader that returns an empty module.

webpack

readme

npm node deps tests chat size

null-loader

A webpack loader that returns an empty module.

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.

Getting Started

To begin, you'll need to install null-loader:

$ npm install null-loader --save-dev

Then add the loader to your webpack config. For example:

// webpack.config.js
const path = require('path');

module.exports = {
  module: {
    rules: [
      {
        // Test for a polyfill (or any file) and it won't be included in your
        // bundle
        test: path.resolve(__dirname, 'node_modules/library/polyfill.js'),
        use: 'null-loader',
      },
    ],
  },
};

And run webpack via your preferred method.

Contributing

Please take a moment to read our contributing guidelines if you haven't yet done so.

CONTRIBUTING

License

MIT

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

4.0.1 (2020-10-09)

Chore

  • update schema-utils

4.0.0 (2020-04-15)

Bug Fixes

  • support webpack@5

⚠ BREAKING CHANGES

  • minimum required Nodejs version is 10.13

3.0.0 (2019-06-05)

chore

BREAKING CHANGES

  • deps: minimum required nodejs version is 8.9.0

2.0.0 (2019-05-15)

Bug Fixes

BREAKING CHANGES

  • loader don't generate comment by default

1.0.0 (2019-04-23)

Bug Fixes

  • don't create binary file
  • relax engines field in package-lock.json

Features

  • validation schema

BREAKING CHANGES

  • validation schema