This repository was archived by the owner on Apr 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathrollup.config.js
65 lines (63 loc) · 1.54 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import * as path from 'path';
import nodeResolve from '@rollup/plugin-node-resolve';
import babel from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import typescript from 'rollup-plugin-typescript2';
import terser from '@rollup/plugin-terser';
import postcss from 'rollup-plugin-postcss';
import autoprefixer from 'autoprefixer';
import svg from 'rollup-plugin-svg';
const EXTENSIONS = ['.js', '.jsx', '.ts', '.tsx'];
const ROOT_PATH = path.join(__dirname);
const SRC_PATH = path.join(ROOT_PATH, 'src');
const DIST_PATH = path.join(ROOT_PATH, 'dist');
export default {
output: {
dir: DIST_PATH,
indent: false,
strict: false,
exports: 'named',
preserveModules: true,
},
input: path.join(SRC_PATH, 'index.ts'),
external: [/node_modules/],
plugins: [
svg(),
commonjs(),
json(),
nodeResolve({
extensions: [...EXTENSIONS, '.json', '.css'],
}),
typescript({
tsconfig: path.join(ROOT_PATH, 'tsconfig.json'),
}),
babel({
babelHelpers: 'bundled',
presets: ['@babel/preset-react'],
extensions: EXTENSIONS,
}),
terser({
compress: {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
},
}),
postcss({
use: [
[
'sass',
{
includePaths: ['src'],
},
],
],
extensions: ['.css', '.scss'],
extract: true,
minimize: true,
plugins: [autoprefixer()],
autoModules: true,
}),
],
};