-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.mjs
61 lines (59 loc) · 1.29 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
58
59
60
61
import { babel } from '@rollup/plugin-babel';
import typescript from '@rollup/plugin-typescript';
import fs from 'fs';
import path from 'path';
import svelte from 'rollup-plugin-svelte';
import resolve from '@rollup/plugin-node-resolve';
import scss from 'rollup-plugin-scss';
import terser from '@rollup/plugin-terser';
import sveltePreprocess from 'svelte-preprocess';
const options = {
input: 'src/js/index.ts',
output: [
{
file: 'dist/index.js',
format: 'cjs',
compact: true,
},
{
file: 'dist/index.es.js',
format: 'es',
compact: true,
},
],
plugins: [
{
name: 'Erase Dist',
buildStart() {
fs.rmSync(path.resolve('dist'), {
recursive: true,
force: true,
});
},
},
babel({
babelHelpers: 'bundled',
exclude: 'node_modules/**',
}),
resolve({
browser: true,
exportConditions: ['svelte'],
extensions: ['.svelte'],
}),
scss({
fileName: 'index.css',
outputStyle: 'compressed',
}),
svelte({
preprocess: sveltePreprocess(),
include: 'src/**/*.svelte',
}),
terser(),
typescript({
module: 'esnext',
declaration: true,
declarationDir: 'dist/types',
}),
],
};
export default options;