write-file-webpack-plugin

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

BSD-3-Clause 30 个版本
安装
npm install write-file-webpack-plugin
yarn add write-file-webpack-plugin
pnpm add write-file-webpack-plugin
bun add write-file-webpack-plugin
README

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.

版本列表
4.5.1 2019-07-29
4.5.0 2018-11-17
4.4.1 2018-09-27
4.4.0 2018-09-05
4.3.2 2018-05-19
4.3.1 2018-05-14
4.3.0 2018-05-14
4.2.0 2017-09-26
4.1.0 2017-06-07
4.0.2 2017-04-15
4.0.0 2017-03-10
3.4.2 2016-11-08
3.4.1 2016-11-02
3.4.0 2016-11-02
3.3.0 2016-09-09
3.1.8 2016-02-27
3.1.7 2016-02-10
3.1.6 2016-02-06
3.1.5 2016-02-05
3.1.4 2016-01-27
3.1.3 2016-01-25
3.1.2 2016-01-25
3.1.1 2016-01-23
3.1.0 2016-01-22
3.0.0 2016-01-22
2.1.2 2015-12-31
2.1.1 2015-12-07
2.1.0 2015-12-07
2.0.0 2015-12-07
1.0.0 2015-10-27