Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build umd with rollup #2283

Merged
merged 4 commits into from
Mar 8, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"test:cov": "yarn test -- --coverage",
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib",
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
"build:umd": "cross-env BABEL_ENV=commonjs NODE_ENV=development webpack src/index.js dist/redux.js",
"build:umd:min": "cross-env BABEL_ENV=commonjs NODE_ENV=production webpack src/index.js dist/redux.min.js",
"build:umd": "cross-env BABEL_ENV=es NODE_ENV=development rollup -c -i src/index.js -o dist/redux.js",
"build:umd:min": "cross-env BABEL_ENV=es NODE_ENV=production rollup -c -i src/index.js -o dist/redux.min.js",
"build": "yarn run build:commonjs && yarn run build:es && yarn run build:umd && yarn run build:umd:min",
"prepublish": "yarn run clean && yarn run lint && yarn test && yarn run build && check-es3-syntax lib/ dist/ --kill --print",
"examples:build": "babel-node examples/buildAll.js",
Expand Down Expand Up @@ -72,7 +72,6 @@
"babel-core": "^6.3.15",
"babel-eslint": "^7.0.0",
"babel-jest": "^18.0.0",
"babel-loader": "^6.2.0",
"babel-plugin-check-es2015-constants": "^6.3.13",
"babel-plugin-transform-es2015-arrow-functions": "^6.3.13",
"babel-plugin-transform-es2015-block-scoped-functions": "^6.3.13",
Expand Down Expand Up @@ -107,10 +106,15 @@
"glob": "^7.1.1",
"jest": "^18.0.0",
"rimraf": "^2.3.4",
"rollup": "^0.41.4",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-commonjs": "^7.1.0",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-replace": "^1.1.1",
"rollup-plugin-uglify": "^1.0.1",
"rxjs": "^5.0.0-beta.6",
"typescript": "^1.8.0",
"typescript-definition-tester": "0.0.4",
"webpack": "^1.9.6"
"typescript-definition-tester": "0.0.4"
},
"npmName": "redux",
"npmFileMap": [
Expand Down
35 changes: 18 additions & 17 deletions webpack.config.js → rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
'use strict';

var webpack = require('webpack')
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';

var env = process.env.NODE_ENV
var config = {
module: {
loaders: [
{ test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ }
]
},
output: {
library: 'Redux',
libraryTarget: 'umd'
},
format: 'umd',
moduleName: 'Redux',
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.DefinePlugin({
nodeResolve({
jsnext: true
}),
commonjs(),
babel({
exclude: 'node_modules/**'
}),
replace({
'process.env.NODE_ENV': JSON.stringify(env)
})
]
};
}

if (env === 'production') {
config.plugins.push(
new webpack.optimize.UglifyJsPlugin({
uglify({
compressor: {
pure_getters: true,
unsafe: true,
Expand All @@ -41,4 +42,4 @@ if (env === 'production') {
)
}

module.exports = config
export default config
Loading