-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
rollup.config.js
52 lines (47 loc) · 1.31 KB
/
rollup.config.js
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import svelte from 'rollup-plugin-svelte';
import typescript from '@rollup/plugin-typescript';
import {nodeResolve} from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';
import autoPreprocess from 'svelte-preprocess';
import ignore from 'rollup-plugin-ignore';
import json from '@rollup/plugin-json';
import {env} from 'process';
import terser from "@rollup/plugin-terser";
const plugins = [
ignore(["path", "url"], { commonjsBugFix: true }),
commonjs({
include: ['node_modules/**', '../cytoscape.js-cxtmenu/**'],
}),
json(),
svelte({
emitCss: false,
preprocess: autoPreprocess(),
}),
typescript({sourceMap: false}),
nodeResolve({browser: true,
dedupe: ['svelte'],
})]
const DEV = env.npm_lifecycle_event === "dev";
if (!DEV) {
plugins.push(terser());
}
plugins.push(copy({
targets: [
{src: 'main.js', dest: 'docs/.obsidian/plugins/juggl'},
{src: 'styles.css', dest: 'docs/.obsidian/plugins/juggl'},
],
hook: 'writeBundle',
}));
export default {
input: 'src/main.ts',
output: {
dir: '.',
sourcemap: DEV ? 'inline' : false,
format: 'cjs',
exports: 'default',
// banner: '/* This file is bundled with rollup. For the source code, see Github */',
},
external: ['obsidian'],
plugins: plugins,
};