A loader that returns an empty module.
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
.circleci refactor(defaults): update to latest webpack-defaults (#15) Apr 5, 2018
.github refactor(defaults): update to latest webpack-defaults (#15) Apr 5, 2018
src refactor(defaults): update to latest webpack-defaults (#15) Apr 5, 2018
test refactor: apply webpack defaults (#8) (#13) Apr 5, 2018
.babelrc refactor(defaults): update to latest webpack-defaults (#15) Apr 5, 2018
.editorconfig refactor(defaults): update to latest webpack-defaults (#15) Apr 5, 2018
.eslintignore refactor: apply webpack defaults (#8) (#13) Apr 5, 2018
.eslintrc refactor: apply webpack defaults (#8) (#13) Apr 5, 2018
.eslintrc.js refactor(defaults): update to latest webpack-defaults (#15) Apr 5, 2018
.gitattributes refactor(defaults): update to latest webpack-defaults (#15) Apr 5, 2018
.gitignore refactor: apply webpack defaults (#8) (#13) Apr 5, 2018
.prettierrc refactor(defaults): update to latest webpack-defaults (#15) Apr 5, 2018
CHANGELOG.md refactor: apply webpack defaults (#8) (#13) Apr 5, 2018
LICENSE refactor: apply webpack defaults (#8) (#13) Apr 5, 2018
README.md refactor(defaults): update to latest webpack-defaults (#15) Apr 5, 2018
codecov.yml refactor(defaults): update to latest webpack-defaults (#15) Apr 5, 2018
commitlint.config.js refactor(defaults): update to latest webpack-defaults (#15) Apr 5, 2018
package-lock.json refactor(defaults): update to latest webpack-defaults (#15) Apr 5, 2018
package.json refactor(defaults): update to latest webpack-defaults (#15) Apr 5, 2018

README.md

npm node deps tests chat

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.

Requirements

This module requires a minimum of Node v6.9.0 and Webpack v4.0.0.

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