-
Notifications
You must be signed in to change notification settings - Fork 73
/
rollup.config.ts
40 lines (38 loc) · 1 KB
/
rollup.config.ts
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
import { nodeResolve } from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import typescript from '@rollup/plugin-typescript';
import { generateSW } from 'rollup-plugin-workbox';
import terser from '@rollup/plugin-terser';
//import babel from 'rollup-plugin-babel'; // To support legacy browsers. Disabled by default.
const plugins = (outDir) => [
nodeResolve(),
typescript({
tsconfig: "./tsconfig.json",
outDir: outDir
}),
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
terser(),
generateSW( {
swDest: 'build/rollup/sw.js',
globDirectory: 'build/rollup/',
globPatterns: [
'dist/**/*.{html,json,js,css}',
'src/lib/**/*.{js, map}'
],
skipWaiting: true,
})
// babel()
];
export default [
{
input: ['src/components/backend-ai-webui.ts'],
output: {
dir: 'build/rollup/dist/components',
format: 'es',
sourcemap: false
},
plugins: plugins('build/rollup/dist/components')
},
];