short-circuit-loader

0.0.2 • Public • Published

short-circuit-loader

Short circuit specified side-effect-only modules for webpack.

This is mainly used to disable browser-side polyfills like classlist-polyfill on the server side.

Installation

npm i --save-dev short-circuit-loader

Configuration

{
  test: /\.js$/,
  include: [
    path.resolve(__dirname, 'node_modules', 'classlist-polyfill')
  ],
  loader: 'short-circuit-loader'
}

Options

  • expr

    A JavaScript expression that skips current module when evaluate to truthy value.

    eg. process.env.VUE_ENV === 'server' makes the final output like this:

    (function () {
      if (process.env.VUE_ENV === 'server') { return }
      // original module
    }())

    Default value: typeof window === 'undefined'.

Package Sidebar

Install

npm i short-circuit-loader

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

3.5 kB

Total Files

5

Last publish

Collaborators

  • justineo