forked from cheapreats/react-ui-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
78 lines (77 loc) · 2.31 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
66
67
68
69
70
71
72
73
74
75
76
77
78
import tsPlugin from 'rollup-plugin-typescript2';
import ttypescript from 'ttypescript';
import babel from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import postcss from 'rollup-plugin-postcss';
import json from '@rollup/plugin-json';
import { DEFAULT_EXTENSIONS } from '@babel/core';
import copy from 'rollup-plugin-copy';
import pkg from './package.json';
export default {
input: 'src/index.ts',
output: [
{
name: '@cheapreats/react-ui',
file: pkg.main,
format: 'cjs',
sourcemap: true,
},
{
file: pkg.module,
format: 'es',
},
],
plugins: [
copy({
targets: [
{ src: 'src/Containers/FileUpload/worker.js', dest: 'dist' },
],
}),
commonjs(),
json(),
tsPlugin({
typescript: ttypescript,
tsconfig: './tsconfig.json',
include: ['*.ts+(|x)', '**/*.ts+(|x)'],
exclude: [
'*.d.ts',
'**/*.d.ts',
'node_modules/**',
'__tests__',
'.vscode',
'.github',
'scripts',
'dist',
],
tsconfigOverride: { compilerOptions: { module: 'es2015' } },
tsconfigDefaults: {
compilerOptions: {
plugins: [{ transform: '@zerollup/ts-transform-paths' }],
},
},
}),
nodeResolve({ preferBuiltins: true }),
babel({
exclude: ['node_modules', 'scripts', 'dist', '*.d.ts', '**/*.d.ts'],
extensions: [...DEFAULT_EXTENSIONS, '.ts', '.tsx'],
plugins: [
'babel-plugin-styled-components',
'babel-plugin-transform-class-properties',
],
presets: [
'@babel/preset-env',
'@babel/preset-react',
'@babel/preset-typescript',
],
babelHelpers: 'bundled',
}),
postcss({
extensions: ['.css'],
}),
],
external: [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
],
};