forked from tw93/Pake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
41 lines (38 loc) · 1.1 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
import path from 'path';
import appRootPath from 'app-root-path';
import typescript from 'rollup-plugin-typescript2';
import alias from '@rollup/plugin-alias';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import replace from '@rollup/plugin-replace';
import pakeCliDevPlugin from './plugins/pakeCliDevPlugin.js';
const isProduction = process.env.NODE_ENV === 'production';
const devPlugins = !isProduction ? [pakeCliDevPlugin()] : [];
export default {
input: isProduction ? 'bin/cli.ts' : 'bin/dev.ts',
output: {
file: isProduction ? 'dist/cli.js' : 'dist/dev.js',
format: 'es',
sourcemap: !isProduction,
},
watch: {
include: 'bin/**',
exclude: 'node_modules/**',
},
plugins: [
json(),
typescript({
tsconfig: 'tsconfig.json',
clean: true, // Clear cache
}),
commonjs(),
replace({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
preventAssignment: true,
}),
alias({
entries: [{ find: '@', replacement: path.join(appRootPath.path, 'bin') }],
}),
...devPlugins,
],
};