-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
65 lines (61 loc) · 1.36 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import svelte from 'rollup-plugin-svelte';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import livereload from 'rollup-plugin-livereload';
import html from 'rollup-plugin-bundle-html';
import { terser } from 'rollup-plugin-terser';
import postcss from 'rollup-plugin-postcss';
import serve from 'rollup-plugin-serve';
import dotenv from 'dotenv';
import typescript from 'rollup-plugin-typescript2';
import typescriptCompiler from 'typescript';
import sveltePreprocessor from 'svelte-preprocess';
import autoprefixer from 'autoprefixer';
dotenv.config();
const plugins = [
svelte({
dev: process.env.DEVELOP_MODE,
css: false,
preprocess: sveltePreprocessor(),
emitCss: true
}),
html({
template: "src/index.html",
dest: "dist",
filename: "index.html"
}),
postcss({
extract: './dist/css/bundle.css',
sourceMap: true,
plugins: [
autoprefixer()
]
}),
typescript({ typescript: typescriptCompiler }),
resolve(),
commonjs()
]
if (process.env.DEVELOP_MODE) {
plugins.push(
serve({
contentBase: './dist',
open: true
}),
livereload({ watch: "./dist" })
);
} else {
plugins.push(terser({ sourcemap: true }))
}
export default {
input: 'src/main.ts',
output: {
sourcemap: true,
format: 'iife',
name: 'app',
file: './dist/js/bundle.js'
},
plugins,
watch: {
clearScreen: false
}
};