-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
60 lines (58 loc) · 1.61 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
/* eslint-disable import/no-extraneous-dependencies */
import purgeCss from '@fullhuman/postcss-purgecss';
import autoprefixer from 'autoprefixer';
import postcssImport from 'postcss-import';
import commonjs from 'rollup-plugin-commonjs';
import livereload from 'rollup-plugin-livereload';
import resolve from 'rollup-plugin-node-resolve';
import postcss from 'rollup-plugin-postcss';
import svelte from 'rollup-plugin-svelte';
import { terser } from 'rollup-plugin-terser';
import tailwind from 'tailwindcss';
import buble from 'rollup-plugin-buble';
import visualize from 'rollup-plugin-visualizer';
const production = !process.env.ROLLUP_WATCH;
export default {
input: 'src/main.js',
output: {
sourcemap: true,
format: 'iife',
name: 'app',
file: 'public/bundle.js'
},
plugins: [
svelte({
dev: !production,
emitCss: true
}),
postcss({
plugins: [
postcssImport,
tailwind('tailwind.config.js'),
production && purgeCss({
content: ['./src/**/*.svelte', './public/index.html'],
defaultExtractor: content => content.match(/[A-Za-z0-9-_:/]+/g) || [],
whitelistPatterns: [/position-(left|right|bottom|top)$/]
}),
production && autoprefixer
].filter(Boolean),
extract: 'public/bundle.css',
minimize: production
}),
resolve({ browser: true }),
commonjs(),
...production ? [
buble({
transforms: {
asyncAwait: false,
dangerousForOf: true
}
}),
terser(),
visualize()
] : [livereload('public')]
],
watch: {
clearScreen: false
}
};