-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.web.js
48 lines (44 loc) · 1.29 KB
/
rollup.config.web.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 dotenv from 'dotenv';
dotenv.config();
const isProduction = process.env.NODE_ENV === 'production';
import cleaner from 'rollup-plugin-cleaner';
import commonjs from '@rollup/plugin-commonjs';
import replace from '@rollup/plugin-replace';
import resolve from '@rollup/plugin-node-resolve';
import serve from 'rollup-plugin-serve';
import systemjs from 'rollup-plugin-systemjs-loader';
import copy from 'rollup-plugin-copy';
import { terser } from 'rollup-plugin-terser';
import typescript from 'rollup-plugin-typescript2';
export default {
input: 'web/index.tsx',
preserveEntrySignatures: false,
output: [
{
dir: 'lib-web',
format: 'system'
}
],
plugins: [
cleaner({
targets: ['./lib-web/']
}),
copy({
targets: [{ src: 'web/index.html', dest: 'lib-web' }]
}),
resolve(),
typescript({ tsconfig: './tsconfig.web.json' }),
commonjs(),
replace({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.SSR': JSON.stringify('')
}),
systemjs({
include: [require.resolve('systemjs/dist/s.js')]
}),
...(isProduction ? [terser({ format: { comments: false } })] : []),
...(!isProduction
? [serve({ contentBase: 'lib-web', port: 8080, historyApiFallback: true })]
: [])
]
};