Skip to content

Commit

Permalink
Rollup (bvaughn#994)
Browse files Browse the repository at this point in the history
Build umd with rollup
  • Loading branch information
TrySound authored Apr 7, 2018
1 parent af90cfe commit 03a1980
Show file tree
Hide file tree
Showing 5 changed files with 249 additions and 36 deletions.
8 changes: 8 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ if (env === 'commonjs' || env === 'es') {
}
}

if (env === 'rollup') {
module.exports = {
comments: false,
plugins: ['external-helpers'],
presets: [['env', { modules: false }], 'react', 'flow', 'stage-2'],
};
}

if (env === 'development') {
module.exports = {
presets: ['react', 'flow', 'stage-2'],
Expand Down
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"build:css": "postcss source/styles.css -o styles.css --use autoprefixer",
"build:demo": "npm run clean:demo && cross-env NODE_ENV=production webpack --config webpack.config.demo.js -p --bail",
"build:es": "npm run clean:es && npm run build:types && cross-env NODE_ENV=es babel source --out-dir dist/es",
"build:umd": "npm run clean:umd && cross-env NODE_ENV=production webpack --config webpack.config.umd.js --bail",
"build:umd": "npm run clean:umd && cross-env NODE_ENV=rollup rollup -c",
"check-all": "yarn prettier && yarn lint && yarn flow",
"ci-check": "yarn prettier:diff && yarn lint && yarn flow",
"clean": "npm run clean:commonjs && npm run clean:demo && npm run clean:es && npm run clean:umd",
Expand Down Expand Up @@ -103,6 +103,7 @@
"babel-eslint": "^8.1.2",
"babel-jest": "^22.0.4",
"babel-loader": "7.1.2",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-flow-react-proptypes": "^13.0.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.12",
Expand Down Expand Up @@ -147,6 +148,12 @@
"react-router": "^4.1.1",
"react-router-dom": "^4.1.1",
"rimraf": "^2.4.3",
"rollup": "^0.57.1",
"rollup-plugin-babel": "^3.0.3",
"rollup-plugin-commonjs": "^9.1.0",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-uglify": "^3.0.0",
"style-loader": "^0.19.1",
"watch": "^1.0.2",
"webpack": "^3.10.0",
Expand Down
38 changes: 38 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import nodeResolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import babel from 'rollup-plugin-babel';
import replace from 'rollup-plugin-replace';
import uglify from 'rollup-plugin-uglify';

export default {
input: './source/index.js',
output: {
file: 'dist/umd/react-virtualized.js',
format: 'umd',
name: 'ReactVirtualized',
globals: {
react: 'React',
'react-dom': 'ReactDOM',
},
},
external: ['react', 'react-dom'],
plugins: [
nodeResolve(),
commonjs({
include: 'node_modules/**',
}),
babel({
exclude: 'node_modules/**',
}),
replace({
'process.env.NODE_ENV': JSON.stringify('development'),
}),
uglify({
mangle: false,
output: {
comments: true,
beautify: true,
},
}),
],
};
35 changes: 0 additions & 35 deletions webpack.config.umd.js

This file was deleted.

Loading

0 comments on commit 03a1980

Please sign in to comment.