Socket
Socket
Sign inDemoInstall

write-file-webpack-plugin

Package Overview
Dependencies
18
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    write-file-webpack-plugin

Forces webpack-dev-server to write bundle files to the file system.


Version published
Weekly downloads
73K
decreased by-12.15%
Maintainers
1
Install size
5.56 MB
Created
Weekly downloads
 

Readme

Source

write-file-webpack-plugin

NPM version js-canonical-style

Forces webpack-dev-server program to write bundle files to the file system.

This plugin has no effect when webpack program is used instead of webpack-dev-server.

Install

npm install write-file-webpack-plugin --save-dev

API

/**
 * @typedef {Object} options
 * @property {boolean} atomicReplace Atomically replace files content (i.e., to prevent programs like test watchers from seeing partial files) (default: true).
 * @property {boolean} exitOnErrors Stop writing files on webpack errors (default: true).
 * @property {boolean} force Forces the execution of the plugin regardless of being using `webpack-dev-server` or not (default: false).
 * @property {boolean} log Logs names of the files that are being written (or skipped because they have not changed) (default: true).
 * @property {RegExp} test A regular expression used to test if file should be written. When not present, all bundle will be written.
 * @property {boolean} useHashIndex Use hash index to write only files that have changed since the last iteration (default: true).
 */

/**
 * @param {options} options
 * @returns {Object}
 */
new WriteFilePlugin();

new WriteFilePlugin({
    // Write only files that have ".css" extension.
    test: /\.css$/,
    useHashIndex: true
});

Usage

Configure webpack.config.js to use the write-file-webpack-plugin plugin.

import path from 'path';
import WriteFilePlugin from 'write-file-webpack-plugin';

export default {
    output: {
        path: path.join(__dirname, './dist')
    },
    plugins: [
        new WriteFilePlugin()
    ],
    // ...
}

See ./sandbox for a working webpack configuration.

Keywords

FAQs

Last updated on 29 Jul 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc