-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
49 lines (46 loc) · 1.28 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
import { removeSync } from 'fs-extra'
import { appConfig } from './package.json'
import { preprocess as svelteWindicss } from 'svelte-windicss-preprocess'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import { terser } from 'rollup-plugin-terser'
import svelte from 'rollup-plugin-svelte'
import livereload from 'rollup-plugin-livereload'
import { wasm } from '@rollup/plugin-wasm'
const { distDir, buildDir } = appConfig
const production = process.env['NODE_ENV'] === 'production'
// clear previous builds
removeSync(distDir)
export default {
preserveEntrySignatures: false,
input: [`src/main.js`],
output: {
sourcemap: true,
format: 'esm',
dir: buildDir,
chunkFileNames: `[name]${(production && '-[hash]') || ''}.js`,
},
plugins: [
svelte({
preprocess: [
svelteWindicss({
compile: false,
prefix: 'windi-',
globalPreflight: true,
globalUtility: true,
}),
],
}),
resolve({
browser: true,
dedupe: (importee) => !!importee.match(/svelte(\/|$)/),
}),
commonjs(),
wasm(),
production && terser(),
!production && livereload(distDir), // refresh entire window when code is updated
],
watch: {
clearScreen: false,
},
}