Skip to content

Commit 03a1980

Browse files
authored
Rollup (bvaughn#994)
Build umd with rollup
1 parent af90cfe commit 03a1980

File tree

5 files changed

+249
-36
lines changed

5 files changed

+249
-36
lines changed

.babelrc.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ if (env === 'commonjs' || env === 'es') {
2424
}
2525
}
2626

27+
if (env === 'rollup') {
28+
module.exports = {
29+
comments: false,
30+
plugins: ['external-helpers'],
31+
presets: [['env', { modules: false }], 'react', 'flow', 'stage-2'],
32+
};
33+
}
34+
2735
if (env === 'development') {
2836
module.exports = {
2937
presets: ['react', 'flow', 'stage-2'],

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"build:css": "postcss source/styles.css -o styles.css --use autoprefixer",
1818
"build:demo": "npm run clean:demo && cross-env NODE_ENV=production webpack --config webpack.config.demo.js -p --bail",
1919
"build:es": "npm run clean:es && npm run build:types && cross-env NODE_ENV=es babel source --out-dir dist/es",
20-
"build:umd": "npm run clean:umd && cross-env NODE_ENV=production webpack --config webpack.config.umd.js --bail",
20+
"build:umd": "npm run clean:umd && cross-env NODE_ENV=rollup rollup -c",
2121
"check-all": "yarn prettier && yarn lint && yarn flow",
2222
"ci-check": "yarn prettier:diff && yarn lint && yarn flow",
2323
"clean": "npm run clean:commonjs && npm run clean:demo && npm run clean:es && npm run clean:umd",
@@ -103,6 +103,7 @@
103103
"babel-eslint": "^8.1.2",
104104
"babel-jest": "^22.0.4",
105105
"babel-loader": "7.1.2",
106+
"babel-plugin-external-helpers": "^6.22.0",
106107
"babel-plugin-flow-react-proptypes": "^13.0.0",
107108
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
108109
"babel-plugin-transform-react-remove-prop-types": "^0.4.12",
@@ -147,6 +148,12 @@
147148
"react-router": "^4.1.1",
148149
"react-router-dom": "^4.1.1",
149150
"rimraf": "^2.4.3",
151+
"rollup": "^0.57.1",
152+
"rollup-plugin-babel": "^3.0.3",
153+
"rollup-plugin-commonjs": "^9.1.0",
154+
"rollup-plugin-node-resolve": "^3.3.0",
155+
"rollup-plugin-replace": "^2.0.0",
156+
"rollup-plugin-uglify": "^3.0.0",
150157
"style-loader": "^0.19.1",
151158
"watch": "^1.0.2",
152159
"webpack": "^3.10.0",

rollup.config.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import nodeResolve from 'rollup-plugin-node-resolve';
2+
import commonjs from 'rollup-plugin-commonjs';
3+
import babel from 'rollup-plugin-babel';
4+
import replace from 'rollup-plugin-replace';
5+
import uglify from 'rollup-plugin-uglify';
6+
7+
export default {
8+
input: './source/index.js',
9+
output: {
10+
file: 'dist/umd/react-virtualized.js',
11+
format: 'umd',
12+
name: 'ReactVirtualized',
13+
globals: {
14+
react: 'React',
15+
'react-dom': 'ReactDOM',
16+
},
17+
},
18+
external: ['react', 'react-dom'],
19+
plugins: [
20+
nodeResolve(),
21+
commonjs({
22+
include: 'node_modules/**',
23+
}),
24+
babel({
25+
exclude: 'node_modules/**',
26+
}),
27+
replace({
28+
'process.env.NODE_ENV': JSON.stringify('development'),
29+
}),
30+
uglify({
31+
mangle: false,
32+
output: {
33+
comments: true,
34+
beautify: true,
35+
},
36+
}),
37+
],
38+
};

webpack.config.umd.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)