1. rollup-plugin-copy-assets
Copy additional assets into the output directory of your rollup bundle.
rollup-plugin-copy-assets
Package: rollup-plugin-copy-assets
Created by: bengsfort
Last modified: Mon, 16 May 2022 04:18:53 GMT
Version: 2.0.3
License: MIT
Downloads: 69,606
Repository: https://github.com/bengsfort/rollup-plugin-copy-assets

Install

npm install rollup-plugin-copy-assets
yarn add rollup-plugin-copy-assets

rollup-plugin-copy-assets

build status coverage npm version

Copy additional assets into the output directory of your rollup bundle.

Installation

 # add with yarn
yarn add --dev rollup-plugin-copy-assets

# or npm
npm install --save-dev rollup-plugin-copy-assets

Usage

 // rollup.config.js
import copy from "rollup-plugin-copy-assets";

export default {
  input: "src/index.js",
  output: {
    file: "dist/bundle.js",
    format: "cjs",
  },
  plugins: [
    copy({
      assets: [
        // You can include directories
        "src/assets",
        // You can also include files
        "src/external/buffer.bin",
      ],
    }),
  ],
};

On final bundle generation the provided files will be copied over into the output folder of your rollup bundle, maintaining the original hierarchy and relativity to the input file:

 # Source directory structure
src/
- index.js
- assets/
  - some-library-needing-special-treatment.js
- external/
  - buffer.bin

# Output directory structure
dist/
- bundle.js
- assets/
  - some-library-needing-special-treatment.js
- external/
  - buffer.bin

Options

  • assets: (required) An array of paths to copy. Accepts files as well as directories.

License

MIT

Dependencies

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin