rollup-plugin-copy-assets
Version:
Copy additional assets into the output directory of your rollup bundle.
69 lines (53 loc) • 1.55 kB
Markdown
  [](https://www.npmjs.com/package/rollup-plugin-copy-assets)
Copy additional assets into the output directory of your rollup bundle.
```shell
yarn add --dev rollup-plugin-copy-assets
npm install --save-dev rollup-plugin-copy-assets
```
```js
// 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:
```bash
src/
- index.js
- assets/
- some-library-needing-special-treatment.js
- external/
- buffer.bin
dist/
- bundle.js
- assets/
- some-library-needing-special-treatment.js
- external/
- buffer.bin
```
- `assets`: **(required)** An array of paths to copy. Accepts files as well as directories.
MIT