Skip to content

Commit 34ca3eb

Browse files
author
Keyan Zhang
committed
added rollup config
1 parent 1afd171 commit 34ca3eb

File tree

3 files changed

+80
-1
lines changed

3 files changed

+80
-1
lines changed

package.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@
5959
"loose-envify": "^1.1.0",
6060
"object-assign": "^4.1.0",
6161
"platform": "^1.1.0",
62+
"rollup": "^0.33.0",
63+
"rollup-plugin-babel": "^2.6.1",
64+
"rollup-plugin-node-resolve": "^1.7.1",
65+
"rollup-plugin-replace": "^1.1.1",
66+
"rollup-plugin-uglify": "^1.0.1",
6267
"run-sequence": "^1.1.4",
6368
"through2": "^2.0.0",
6469
"tmp": "~0.0.28",
@@ -79,7 +84,9 @@
7984
"lint": "grunt lint",
8085
"postinstall": "node node_modules/fbjs-scripts/node/check-dev-engines.js package.json",
8186
"test": "jest",
82-
"flow": "flow"
87+
"flow": "flow",
88+
"rollup:dev": "rollup -c scripts/rollup/rollup.config.dev.js",
89+
"rollup:prod": "rollup -c scripts/rollup/rollup.config.prod.js"
8390
},
8491
"jest": {
8592
"modulePathIgnorePatterns": [

scripts/rollup/rollup.config.dev.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* Copyright (c) 2013-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
'use strict';
10+
11+
var babel = require('rollup-plugin-babel');
12+
var replace = require('rollup-plugin-replace');
13+
var resolve = require('rollup-plugin-node-resolve');
14+
15+
var babelEs6ModulifyPlugin = require('../babel/transform-es6-modulify');
16+
17+
module.exports = {
18+
dest: 'build/react.rollup.dev.js',
19+
entry: 'build/modules/ReactUMDEntry.js',
20+
moduleName: 'React',
21+
format: 'umd',
22+
plugins: [
23+
babel({
24+
babelrc: false,
25+
plugins: [babelEs6ModulifyPlugin],
26+
}),
27+
replace({
28+
'process.env.NODE_ENV': JSON.stringify('development'),
29+
}),
30+
resolve({
31+
main: true,
32+
}),
33+
],
34+
sourceMap: false,
35+
};

scripts/rollup/rollup.config.prod.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Copyright (c) 2013-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
'use strict';
10+
11+
var babel = require('rollup-plugin-babel');
12+
var replace = require('rollup-plugin-replace');
13+
var resolve = require('rollup-plugin-node-resolve');
14+
var uglify = require('rollup-plugin-uglify');
15+
16+
var babelEs6ModulifyPlugin = require('../babel/transform-es6-modulify');
17+
18+
module.exports = {
19+
dest: 'build/react.rollup.prod.js',
20+
entry: 'build/modules/ReactUMDEntry.js',
21+
moduleName: 'React',
22+
format: 'umd',
23+
plugins: [
24+
babel({
25+
babelrc: false,
26+
plugins: [babelEs6ModulifyPlugin],
27+
}),
28+
replace({
29+
'process.env.NODE_ENV': JSON.stringify('production'),
30+
}),
31+
resolve({
32+
main: true,
33+
}),
34+
uglify(),
35+
],
36+
sourceMap: false,
37+
};

0 commit comments

Comments
 (0)