Skip to content

Commit

Permalink
added rollup config
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyan Zhang committed Jul 3, 2016
1 parent 1afd171 commit 34ca3eb
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 1 deletion.
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
"loose-envify": "^1.1.0",
"object-assign": "^4.1.0",
"platform": "^1.1.0",
"rollup": "^0.33.0",
"rollup-plugin-babel": "^2.6.1",
"rollup-plugin-node-resolve": "^1.7.1",
"rollup-plugin-replace": "^1.1.1",
"rollup-plugin-uglify": "^1.0.1",
"run-sequence": "^1.1.4",
"through2": "^2.0.0",
"tmp": "~0.0.28",
Expand All @@ -79,7 +84,9 @@
"lint": "grunt lint",
"postinstall": "node node_modules/fbjs-scripts/node/check-dev-engines.js package.json",
"test": "jest",
"flow": "flow"
"flow": "flow",
"rollup:dev": "rollup -c scripts/rollup/rollup.config.dev.js",
"rollup:prod": "rollup -c scripts/rollup/rollup.config.prod.js"
},
"jest": {
"modulePathIgnorePatterns": [
Expand Down
35 changes: 35 additions & 0 deletions scripts/rollup/rollup.config.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';

var babel = require('rollup-plugin-babel');
var replace = require('rollup-plugin-replace');
var resolve = require('rollup-plugin-node-resolve');

var babelEs6ModulifyPlugin = require('../babel/transform-es6-modulify');

module.exports = {
dest: 'build/react.rollup.dev.js',
entry: 'build/modules/ReactUMDEntry.js',
moduleName: 'React',
format: 'umd',
plugins: [
babel({
babelrc: false,
plugins: [babelEs6ModulifyPlugin],
}),
replace({
'process.env.NODE_ENV': JSON.stringify('development'),
}),
resolve({
main: true,
}),
],
sourceMap: false,
};
37 changes: 37 additions & 0 deletions scripts/rollup/rollup.config.prod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';

var babel = require('rollup-plugin-babel');
var replace = require('rollup-plugin-replace');
var resolve = require('rollup-plugin-node-resolve');
var uglify = require('rollup-plugin-uglify');

var babelEs6ModulifyPlugin = require('../babel/transform-es6-modulify');

module.exports = {
dest: 'build/react.rollup.prod.js',
entry: 'build/modules/ReactUMDEntry.js',
moduleName: 'React',
format: 'umd',
plugins: [
babel({
babelrc: false,
plugins: [babelEs6ModulifyPlugin],
}),
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
resolve({
main: true,
}),
uglify(),
],
sourceMap: false,
};

0 comments on commit 34ca3eb

Please sign in to comment.