-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.mjs
More file actions
29 lines (28 loc) · 819 Bytes
/
rollup.config.mjs
File metadata and controls
29 lines (28 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { copyFileSync, existsSync } from "node:fs";
import { resolve, dirname } from "node:path";
export default args => {
const configs = args.configDefaultConfig;
let assetsCopied = false;
return configs.map(config => ({
...config,
plugins: [
...(config.plugins || []),
{
name: "copy-assets",
writeBundle(options) {
if (assetsCopied) return;
const outDir = options.dir || dirname(options.file);
const src = resolve("src/assets/doom.jsdos");
if (existsSync(src)) {
copyFileSync(src, resolve(outDir, "doom.jsdos"));
assetsCopied = true;
}
}
}
],
onwarn(warning, warn) {
if (warning.code === "CIRCULAR_DEPENDENCY") return;
config.onwarn(warning, warn);
}
}));
};