-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
49 lines (41 loc) · 1.06 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 { createRollupConfigs } from './scripts/base.config.js'
import autoPreprocess from 'svelte-preprocess'
import postcssImport from 'postcss-import'
import replace from '@rollup/plugin-replace'
require('dotenv').config();
const production = !process.env.ROLLUP_WATCH;
export const config = {
staticDir: 'static',
distDir: 'dist',
buildDir: `dist/build`,
serve: !production,
production,
rollupWrapper: rollup => {
rollup.plugins.push(
replace({ MAPBOX_API_KEY:
process.env.MAPBOX_API_KEY })
)
},
svelteWrapper: svelte => {
svelte.preprocess = [
autoPreprocess({
postcss: { plugins: [postcssImport()] },
defaults: { style: 'postcss' }
})]
},
swWrapper: worker => worker
}
const configs = createRollupConfigs(config)
export default configs
/**
Wrappers can either mutate or return a config
wrapper example 1
svelteWrapper: (cfg, ctx) => {
cfg.preprocess: mdsvex({ extension: '.md' }),
}
wrapper example 2
rollupWrapper: cfg => {
cfg.plugins = [...cfg.plugins, myPlugin()]
return cfg
}
*/