-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.app.js
64 lines (61 loc) · 1.5 KB
/
rollup.config.app.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import typescript from 'rollup-plugin-typescript2'
import typescriptCompiler from 'typescript'
import commonjs from '@rollup/plugin-commonjs'
import resolve from '@rollup/plugin-node-resolve'
import html2 from 'rollup-plugin-html2'
import svelte from 'rollup-plugin-svelte'
import serve from 'rollup-plugin-serve'
import postcss from 'rollup-plugin-postcss'
import livereload from 'rollup-plugin-livereload'
import sveltePreprocessor from 'svelte-preprocess'
import { terser } from 'rollup-plugin-terser'
import { string } from 'rollup-plugin-string'
import builtins from 'rollup-plugin-node-builtins'
import globals from 'rollup-plugin-node-globals'
const isDevelopment = process.env.NODE_ENV === 'development'
const plugins = [
svelte({
dev: isDevelopment,
extensions: ['.svelte'],
preprocess: sveltePreprocessor(),
emitCss: true,
}),
globals(),
builtins(),
typescript({
tsconfig: './tsconfig.app.json',
typescript: typescriptCompiler,
}),
resolve(),
postcss({
extract: true,
}),
string({
include: '**/*.txt',
}),
commonjs({ include: 'node_modules/**', extensions: ['.js', '.ts'] }),
html2({
template: 'app/index.html',
}),
]
if (isDevelopment) {
plugins.push(
serve({
contentBase: './dist',
open: false,
port: 6800,
}),
livereload({ watch: './dist' })
)
} else {
plugins.push(terser())
}
module.exports = {
input: 'app/index.js',
output: {
file: 'dist/index.js',
sourcemap: true,
format: 'iife',
},
plugins,
}