Skip to content

Commit

Permalink
Generate UMD build with Rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Oct 27, 2015
1 parent 0581098 commit 78d98e8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
22 changes: 22 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
var rollup = require( 'rollup' );
var babel = require( 'rollup-plugin-babel' );
var replace = require( 'rollup-plugin-replace' );

var env = process.argv[2] === '--prod' ? 'production' : 'development';

rollup.rollup({
entry: 'src/index.js',
plugins: [
replace({
'process.env.NODE_ENV': JSON.stringify(env)
}),
babel()
]
}).then(function (bundle) {
var code = bundle.generate({
format: 'umd',
moduleName: 'Redux'
}).code;

process.stdout.write(code);
});
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"test:examples": "babel-node examples/testAll.js",
"check": "npm run lint && npm run test",
"build:lib": "babel src --out-dir lib",
"build:umd": "webpack src/index.js dist/redux.js --config webpack.config.development.js",
"build:umd:min": "webpack src/index.js dist/redux.min.js --config webpack.config.production.js",
"build:umd": "node build.js > dist/redux.js",
"build:umd:min": "node build.js --prod | uglifyjs -c warnings=false -m --screw-ie8 > dist/redux.min.js",
"build:examples": "babel-node examples/buildAll.js",
"build": "npm run build:lib && npm run build:umd && npm run build:umd:min",
"build": "npm run build:lib && rm -rf dist && mkdir -p dist && npm run build:umd && npm run build:umd:min",
"preversion": "npm run clean && npm run check",
"version": "npm run build",
"postversion": "git push && git push --tags && npm run clean && npm run docs:publish",
Expand Down Expand Up @@ -66,6 +66,9 @@
"isparta": "^3.0.3",
"mocha": "^2.2.5",
"rimraf": "^2.3.4",
"rollup": "^0.20.2",
"rollup-plugin-babel": "^1.0.0",
"rollup-plugin-replace": "^1.0.1",
"webpack": "^1.9.6"
},
"npmName": "redux",
Expand Down

0 comments on commit 78d98e8

Please sign in to comment.