-
Notifications
You must be signed in to change notification settings - Fork 21
/
rollup.prod.config.js
60 lines (55 loc) · 1.34 KB
/
rollup.prod.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
51
52
53
54
55
56
57
58
59
60
/* eslint-disable sort-keys, import/no-extraneous-dependencies */
import path from 'path';
import babel from '@rollup/plugin-babel';
import del from 'rollup-plugin-delete';
import staticImport from 'rollup-plugin-static-import';
import resolve from '@rollup/plugin-node-resolve';
import sourcemaps from 'rollup-plugin-sourcemaps';
import svgr from '@svgr/rollup';
const fullSrcPath = path.resolve('src');
const config = {
input: 'src/index.js',
output: [
{
dir: 'lib/cjs',
format: 'cjs',
sourcemap: true,
exports: 'auto',
},
{
dir: 'lib/esm',
format: 'esm',
sourcemap: true,
exports: 'auto',
},
],
external: id => !id.startsWith('.') && !id.startsWith(fullSrcPath),
preserveModules: true,
plugins: [
staticImport({
include: [
'src/**/*.bmp',
'src/**/*.gif',
'src/**/*.jpg',
'src/**/*.jpeg',
'src/**/*.png',
'src/**/*.css',
'src/**/*.scss',
'src/**/*.sass',
'src/**/*.less',
'src/**/*.json',
],
}),
sourcemaps(),
resolve({ jail: fullSrcPath }),
babel({
include: 'src/**/*.js',
babelHelpers: 'runtime',
skipPreflightCheck: true,
sourceMaps: true,
}),
svgr({ include: 'src/**/*.svg' }),
del({ targets: 'lib/' }),
],
};
export default config;