forked from reuseman/flashcards-obsidian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
48 lines (43 loc) · 1.05 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
import typescript from '@rollup/plugin-typescript';
import {nodeResolve} from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
const PRODUCTION_PLUGIN_CONFIG = {
input: 'main.ts',
output: {
dir: '.',
sourcemap: 'inline',
sourcemapExcludeSources: true,
format: 'cjs',
exports: 'default'
},
external: ['obsidian'],
plugins: [
typescript(),
nodeResolve({browser: true}),
commonjs(),
]
};
const DEV_PLUGIN_CONFIG = {
input: 'main.ts',
output: {
dir: 'docs/test-vault/.obsidian/plugins/flashcards-obsidian/',
sourcemap: 'inline',
format: 'cjs',
exports: 'default'
},
external: ['obsidian'],
plugins: [
typescript(),
nodeResolve({browser: true}),
commonjs(),
]
};
let configs = []
if (process.env.BUILD === "dev") {
configs.push(DEV_PLUGIN_CONFIG);
} else if (process.env.BUILD === "production" ) {
configs.push(PRODUCTION_PLUGIN_CONFIG);
} else {
configs.push(DEV_PLUGIN_CONFIG);
}
export default configs;