Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

Latest commit

 

History

History
73 lines (56 loc) · 2.24 KB

README.md

File metadata and controls

73 lines (56 loc) · 2.24 KB

Webpack Copy Bundle Plugin

NPM License Coverage Downloads Build

Webpack plugin to copy your bundle after a successful build.

In some cases you might want to copy your bundle to a directory after a successful build. However, Webpack does not allow you to do these 'out-of-source' builds. You can use the standard Webpack Copy Plugin, however then you need to manually copy all related files (bundle, source-map, etc.). To make this a bit easier you can use the Webpack Copy Bundle Plugin

Using this plugin you can give a list of bundles to copy and where to copy them to. The plugin takes care of copying all of the related files to the output directory.

Installation

npm install webpack-copy-bundle --save-dev

Usage

const WebpackCopyBundle = require('./src');

module.exports = {

    entry: './src/index.js',

    plugins: [
        new WebpackCopyBundle({
            main: '../example/folder',
        })
    ]
};

Example of multiple entries:

const WebpackCopyBundle = require('./src');

module.exports = {

    entry: {
        main: './src/index.js',
        worker: './src/worker.js'
    },

    plugins: [
        new WebpackCopyBundle({
            main: '../example/folder',
            worker: '../example/folder/worker',
        })
    ]
};