Socket
Socket
Sign inDemoInstall

no-emit-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

no-emit-webpack-plugin

Stop an asset from being emitted by the webpack compiler.


Version published
Weekly downloads
594
increased by12.93%
Maintainers
1
Weekly downloads
 
Created
Source

No Emit WebPack Plugin

Build Status

Stop an asset from being emitted by the webpack compiler.

Install

Webpack 5

npm install --save-dev no-emit-webpack-plugin
yarn add -D no-emit-webpack-plugin

Webpack 4

npm install --save-dev no-emit-webpack-plugin@3.0.0
yarn add -D no-emit-webpack-plugin@3.0.0

Options

:warning: By default, if you don't supply any options the bundles for all entry points will be removed.

new NoEmitPlugin(options: string | array)
  • If a string is supplied only one asset bundle will be removed.
  • The array must be composed of elements with type string that will be matched with asset bundle names, and removed.

Usage

This plugin is most useful when you are bundling assets that start from file types other than JavaScript, like styles for instance. With it you can remove the resulting file defined in the output option of your webpack.config.js.

Below is an example on how to remove the style.js file from the emitted assets. We'll use the Mini CSS Extract Plugin to generate the CSS asset.

const ExtractTextPlugin = require('extract-text-webpack-plugin');
const NoEmitPlugin = require('no-emit-webpack-plugin');

module.exports = {
  entry: {
    style: path.resolve(__dirname, 'style.css'),
    main: path.resolve(__dirname, 'main.js'),
  },
  module: {
    rules: [{
      test: /\.css/iu,
      use: [
        MiniCssExtractPlugin.loader,
        'css-loader',
      ],
    }],
  },
  plugins: [new MiniCssExtractPlugin()],
}

License

MIT © Pedro Duarte

Keywords

FAQs

Package last updated on 03 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc