webpack-copy-bundle

Webpack plugin to copy your bundle after a successful build.

Usage no npm install needed!

<script type="module">
  import webpackCopyBundle from 'https://cdn.skypack.dev/webpack-copy-bundle';
</script>

README

Webpack Copy Bundle Plugin

NPM License Coverage Quality Code Climate 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',
        })
    ]
};