-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.prod.js
More file actions
71 lines (66 loc) · 1.63 KB
/
rollup.config.prod.js
File metadata and controls
71 lines (66 loc) · 1.63 KB
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
import resolve from 'rollup-plugin-node-resolve'
import postcss from 'rollup-plugin-postcss'
import babel from 'rollup-plugin-babel'
import replace from 'rollup-plugin-replace'
import commonjs from 'rollup-plugin-commonjs'
import uglify from 'rollup-plugin-uglify-es'
import filesize from 'rollup-plugin-filesize'
// add postcss plugins
import simplevars from 'postcss-simple-vars'
import nested from 'postcss-nested'
import cssnext from 'postcss-cssnext'
import cssnano from 'cssnano'
const pkg = require('./package.json')
const fistLetterUpper = function(str) {
return str.charAt(0).toUpperCase() + str.slice(1)
}
export default {
input: 'src/index.js',
external: ['react', 'react-dom', 'prop-types'],
plugins: [
babel({
exclude: 'node_modules/**',
}),
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
postcss({
extensions: ['.stylus'],
plugins: [
simplevars(),
nested(),
cssnext({ warnForDuplicates: false }),
cssnano(),
],
}),
resolve(),
commonjs({
include: 'node_modules/**',
}),
uglify(),
filesize(),
],
output: [
{
file: './lib/hello.min.js',
format: 'umd',
name: fistLetterUpper(pkg.name),
globals: {
react: 'React',
'react-dom': 'ReactDOM',
'prop-types': 'PropTypes',
},
sourcemap: true,
}, {
file: './es/hello.es.js',
format: 'es',
globals: {
react: 'React',
'react-dom': 'ReactDOM',
'prop-types': 'PropTypes',
},
banner: '// welcome to here',
footer: '// powered by love',
},
],
}