-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
rollup.config.cjs
38 lines (36 loc) · 1.07 KB
/
rollup.config.cjs
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
import babel from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import replace from '@rollup/plugin-replace';
import resolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
// import million from 'million/compiler';
import { env } from 'process';
const isProd = env.NODE_ENV === 'production';
export default {
context: 'window',
input: 'src/main.ts',
output: {
file: isProd ? 'dist/main.js' : 'main.js',
format: 'cjs',
exports: 'default',
sourcemap: !isProd,
},
external: ['obsidian', 'fs', 'os', 'path'],
plugins: [
typescript(),
resolve({
browser: true,
}),
replace({
preventAssignment: false,
'process.env.NODE_ENV': JSON.stringify(env.NODE_ENV),
}),
babel({
babelHelpers: 'bundled',
presets: ['@babel/preset-react', '@babel/preset-typescript'],
compact: true,
}),
commonjs(),
// million.rollup({ auto: true }),
],
};