-
-
Notifications
You must be signed in to change notification settings - Fork 527
/
rollup.config.dev.js
88 lines (83 loc) · 1.96 KB
/
rollup.config.dev.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
79
80
81
82
83
84
85
86
87
88
// import analyze from 'rollup-plugin-analyzer'
import commonjs from '@rollup/plugin-commonjs'
import filesize from 'rollup-plugin-filesize'
import postcss from 'rollup-plugin-postcss'
import progress from 'rollup-plugin-progress'
import browsersync from 'rollup-plugin-browsersync'
import html from 'rollup-plugin-html-scaffold'
import replace from '@rollup/plugin-replace'
import copy from 'rollup-plugin-copy'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import ts from '@rollup/plugin-typescript'
import typescript from 'typescript'
const input = ['src/index-dev.tsx']
const name = 'ReactTooltip'
const globals = {
react: 'React',
'react-dom': 'ReactDOM',
classnames: 'classNames',
'prop-types': 'PropTypes',
}
const plugins = [
progress(),
html({
input: './public/index-rollup.html',
output: './build/index.html',
template: { appBundle: 'index.js' },
}),
replace({
preventAssignment: true,
values: {
'process.env.NODE_ENV': JSON.stringify('development'),
},
}),
postcss({
extract: true,
autoModules: true,
include: '**/*.css',
extensions: ['.css'],
plugins: [],
}),
nodeResolve(),
ts({
typescript,
tsconfig: './tsconfig.json',
noEmitOnError: false,
// declaration: true,
// declarationDir: './build',
}),
commonjs({
include: 'node_modules/**',
}),
// analyze(), // to check diff of file size when bundle
filesize(),
copy({
// targets: [
// { src: 'src/assets', dest: 'build/' },
// { src: 'public/manifest.json', dest: 'build/' },
// { src: 'public/offline.html', dest: 'build/' },
// ],
targets: [{ src: 'dist/', dest: 'build/' }],
verbose: true,
}),
browsersync({
server: 'build',
watch: true,
ui: false,
open: false,
// port: 3000,
// ui: {
// port: 3001,
// },
}),
]
export default {
input,
output: {
file: 'build/index.js',
format: 'umd',
name,
globals,
},
plugins,
}