Skip to content

Commit

Permalink
Add production bundles for Test and Shallow renderers (#11112)
Browse files Browse the repository at this point in the history
* Add production bundles for Test and Shallow renderers

* Remove unused/broken file from test renderer

* Add production bundle for TestUtils
  • Loading branch information
gaearon authored Oct 5, 2017
1 parent fa7461e commit 7d3b44b
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 17 deletions.
4 changes: 2 additions & 2 deletions packages/react-dom/test-utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

if (process.env.NODE_ENV === 'production') {
throw Error('test-utils is not available in production mode.');
module.exports = require('./cjs/react-dom-test-utils.production.min.js');
} else {
module.exports = require('./cjs/react-dom-test-utils.development');
module.exports = require('./cjs/react-dom-test-utils.development.js');
}
4 changes: 2 additions & 2 deletions packages/react-test-renderer/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

if (process.env.NODE_ENV === 'production') {
throw Error('test renderer is not available in production mode.');
module.exports = require('./cjs/react-test-renderer.production.min.js');
} else {
module.exports = require('./cjs/react-test-renderer.development');
module.exports = require('./cjs/react-test-renderer.development.js');
}
1 change: 0 additions & 1 deletion packages/react-test-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"README.md",
"index.js",
"shallow.js",
"stack.js",
"cjs/"
]
}
4 changes: 2 additions & 2 deletions packages/react-test-renderer/shallow.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

if (process.env.NODE_ENV === 'production') {
throw Error('shallow renderer is not available in production mode.');
module.exports = require('./cjs/react-test-renderer-shallow.production.min.js');
} else {
module.exports = require('./cjs/react-test-renderer-shallow.development');
module.exports = require('./cjs/react-test-renderer-shallow.development.js');
}
7 changes: 0 additions & 7 deletions packages/react-test-renderer/stack.js

This file was deleted.

6 changes: 3 additions & 3 deletions scripts/rollup/bundles.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const bundles = [
},
{
babelOpts: babelOptsReact,
bundleTypes: [FB_DEV, NODE_DEV],
bundleTypes: [FB_DEV, NODE_DEV, NODE_PROD],
config: {
destDir: 'build/',
globals: {
Expand Down Expand Up @@ -325,7 +325,7 @@ const bundles = [
/******* React Test Renderer *******/
{
babelOpts: babelOptsReact,
bundleTypes: [FB_DEV, NODE_DEV],
bundleTypes: [FB_DEV, NODE_DEV, NODE_PROD],
config: {
destDir: 'build/',
moduleName: 'ReactTestRenderer',
Expand All @@ -350,7 +350,7 @@ const bundles = [
},
{
babelOpts: babelOptsReact,
bundleTypes: [FB_DEV, NODE_DEV],
bundleTypes: [FB_DEV, NODE_DEV, NODE_PROD],
config: {
destDir: 'build/',
moduleName: 'ReactShallowRenderer',
Expand Down
12 changes: 12 additions & 0 deletions scripts/rollup/results.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,18 @@
"ReactNativeRTFiber-prod.js (RN_PROD)": {
"size": 167912,
"gzip": 28774
},
"react-test-renderer.production.min.js (NODE_PROD)": {
"size": 53838,
"gzip": 16625
},
"react-test-renderer-shallow.production.min.js (NODE_PROD)": {
"size": 4508,
"gzip": 1637
},
"react-dom-test-utils.production.min.js (NODE_PROD)": {
"size": 11608,
"gzip": 4241
}
}
}

0 comments on commit 7d3b44b

Please sign in to comment.