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

Add production bundles for Test and Shallow renderers #11112

Merged
merged 3 commits into from
Oct 5, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
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');
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with other packages.

}
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
}
}
}