-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.mjs
57 lines (55 loc) · 1.54 KB
/
rollup.config.mjs
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
import svelte from 'rollup-plugin-svelte';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import css from 'rollup-plugin-css-only';
import { globbySync } from 'globby';
import sveltePreprocess from 'svelte-preprocess';
import typescript from '@rollup/plugin-typescript';
import { wasm } from '@rollup/plugin-wasm';
import svg from 'rollup-plugin-svg';
import json from '@rollup/plugin-json';
import inlineSvg from 'rollup-plugin-inline-svg';
const production = !process.env.ROLLUP_WATCH;
const formats = ['iife', 'umd', 'es']; //
const components = ['Portal']; // globbySync('src/lib/**/*.svelte').map((path) => path.split('/')[2]);
export default components.map((component) => ({
input: `src/lib/${component}.svelte`,
output: formats.map((format) => ({
name: component,
file: `src/lib/bundled/${format}/${component}.min.js`, // gets added to deployments & package manager this way
// dir: `build/components/`,
format,
inlineDynamicImports: true
// sourcemap: true
})),
plugins: [
json(),
inlineSvg({}),
typescript({
sourceMap: !production
}),
wasm(),
svg(),
svelte({
compilerOptions: {
dev: !production
// customElement: true
},
preprocess: sveltePreprocess({
sourceMap: !production
}),
emitCss: false // inline
}),
css({ output: 'bundle.css' }), // not needed if emitCss: false
resolve({
browser: true,
dedupe: ['svelte']
}),
commonjs()
// terser()
],
watch: {
clearScreen: false
}
}));