-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
50 lines (43 loc) · 1.15 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
import { createRollupConfigs } from './scripts/base.config.js';
import autoPreprocess from 'svelte-preprocess';
import postcssImport from 'postcss-import';
import postcss from 'rollup-plugin-postcss';
const production = !process.env.ROLLUP_WATCH;
process.env.NODE_ENV = production ? 'production' : 'development';
export const config = {
staticDir: 'static',
distDir: 'dist',
buildDir: 'dist/build',
serve: !production,
production,
rollupWrapper: (rollup) => {
rollup.plugins = [
...rollup.plugins,
postcss({ plugins: [postcssImport()] }),
];
return rollup;
},
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
}
*/