Skip to content

Commit

Permalink
Externalize Scheduler in noop and test bundles
Browse files Browse the repository at this point in the history
I also noticed we don't need to regenerator runtime in noop anymore.
  • Loading branch information
acdlite committed Feb 28, 2019
1 parent 1646bed commit 00b3c37
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 44 deletions.
49 changes: 5 additions & 44 deletions scripts/rollup/bundles.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,15 @@ const bundles = [
moduleType: RENDERER,
entry: 'react-test-renderer',
global: 'ReactTestRenderer',
externals: ['react'],
externals: ['react', 'scheduler', 'scheduler/unstable_mock'],
},

{
bundleTypes: [FB_WWW_DEV, NODE_DEV, NODE_PROD, UMD_DEV, UMD_PROD],
moduleType: NON_FIBER_RENDERER,
entry: 'react-test-renderer/shallow',
global: 'ReactShallowRenderer',
externals: ['react'],
externals: ['react', 'scheduler', 'scheduler/unstable_mock'],
},

/******* React Noop Renderer (used for tests) *******/
Expand All @@ -298,20 +298,7 @@ const bundles = [
moduleType: RENDERER,
entry: 'react-noop-renderer',
global: 'ReactNoopRenderer',
externals: ['react', 'expect'],
// React Noop uses generators. However GCC currently
// breaks when we attempt to use them in the output.
// So we precompile them with regenerator, and include
// it as a runtime dependency of React Noop. In practice
// this isn't an issue because React Noop is only used
// in our tests. We wouldn't want to do this for any
// public package though.
babel: opts =>
Object.assign({}, opts, {
plugins: opts.plugins.concat([
require.resolve('babel-plugin-transform-regenerator'),
]),
}),
externals: ['react', 'scheduler', 'scheduler/unstable_mock', 'expect'],
},

/******* React Noop Persistent Renderer (used for tests) *******/
Expand All @@ -320,20 +307,7 @@ const bundles = [
moduleType: RENDERER,
entry: 'react-noop-renderer/persistent',
global: 'ReactNoopRendererPersistent',
externals: ['react', 'expect'],
// React Noop uses generators. However GCC currently
// breaks when we attempt to use them in the output.
// So we precompile them with regenerator, and include
// it as a runtime dependency of React Noop. In practice
// this isn't an issue because React Noop is only used
// in our tests. We wouldn't want to do this for any
// public package though.
babel: opts =>
Object.assign({}, opts, {
plugins: opts.plugins.concat([
require.resolve('babel-plugin-transform-regenerator'),
]),
}),
externals: ['react', 'scheduler', 'expect'],
},

/******* React Noop Server Renderer (used for tests) *******/
Expand All @@ -342,20 +316,7 @@ const bundles = [
moduleType: RENDERER,
entry: 'react-noop-renderer/server',
global: 'ReactNoopRendererServer',
externals: ['react', 'expect'],
// React Noop uses generators. However GCC currently
// breaks when we attempt to use them in the output.
// So we precompile them with regenerator, and include
// it as a runtime dependency of React Noop. In practice
// this isn't an issue because React Noop is only used
// in our tests. We wouldn't want to do this for any
// public package though.
babel: opts =>
Object.assign({}, opts, {
plugins: opts.plugins.concat([
require.resolve('babel-plugin-transform-regenerator'),
]),
}),
externals: ['react', 'scheduler', 'expect'],
},

/******* React Reconciler *******/
Expand Down
1 change: 1 addition & 0 deletions scripts/rollup/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const knownGlobals = Object.freeze({
'react-dom': 'ReactDOM',
scheduler: 'Scheduler',
'scheduler/tracing': 'SchedulerTracing',
'scheduler/unstable_mock': 'SchedulerMock',
});

// Given ['react'] in bundle externals, returns { 'react': 'React' }.
Expand Down

0 comments on commit 00b3c37

Please sign in to comment.