Giter Site home page Giter Site logo

write-file-webpack-plugin's Introduction

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.

write-file-webpack-plugin's People

Contributors

gajus avatar chrisblossom avatar zhuangya avatar veetil09 avatar max-b avatar teameh avatar sammaxwellxyz avatar rknoll avatar owenoak avatar mike-engel avatar michaelkhabarov avatar koistya avatar jkzing avatar g4vroche avatar transplier avatar cheton avatar changliuunsw avatar andybitz avatar

Stargazers

Kyle Liu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.