-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Update rollup to v3 #26078
Update rollup to v3 #26078
Changes from all commits
2499372
d4e7748
746e522
4993cca
104c2da
97dc0ac
6162fbe
bb89255
4cb72d3
203f0e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ const sizes = require('./plugins/sizes-plugin'); | |
const useForks = require('./plugins/use-forks-plugin'); | ||
const stripUnusedImports = require('./plugins/strip-unused-imports'); | ||
const dynamicImports = require('./plugins/dynamic-imports'); | ||
const disableTreeshake = require('./plugins/disable-treeshake'); | ||
const Packaging = require('./packaging'); | ||
const {asyncRimRaf} = require('./utils'); | ||
const codeFrame = require('@babel/code-frame'); | ||
|
@@ -188,7 +189,7 @@ function getRollupOutputOptions( | |
format, | ||
globals, | ||
freeze: !isProduction, | ||
interop: false, | ||
interop: 'default', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The interop configuration uses the default values to minimize the size increase of the production bundles and pass the ci, and to be honest I'm not very confident about this change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From looking at the generated output files, I think this looks mostly right. There's still a bit of extra code here (you can see the diffs in this comment #26078 (comment) ) Example larger build where the change is visible: https://react-builds.vercel.app/commits/cc7dbd62a503bf502eb911b82a28926cf4d177e9/files/oss-stable/react-debug-tools/cjs/react-debug-tools.development.js?compare=4a4ef2706cfb51db96d48fe20dadcb4fb8e3cb17 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pretty sure this should be |
||
name: globalName, | ||
sourcemap: false, | ||
esModule: false, | ||
|
@@ -333,6 +334,7 @@ function getPlugins( | |
bundleType === RN_FB_PROFILING; | ||
const shouldStayReadable = isFBWWWBundle || isRNBundle || forcePrettyOutput; | ||
return [ | ||
disableTreeshake(), | ||
// Keep dynamic imports as externals | ||
dynamicImports(), | ||
{ | ||
|
@@ -616,7 +618,7 @@ async function createBundle(bundle, bundleType) { | |
output: { | ||
externalLiveBindings: false, | ||
freeze: false, | ||
interop: false, | ||
interop: 'default', | ||
esModule: false, | ||
}, | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
'use strict'; | ||
|
||
module.exports = function disableTreeshake() { | ||
return { | ||
name: 'scripts/rollup/plugins/disable-treeshake', | ||
transform(code, id) { | ||
if (id.endsWith('DOMProperty.js')) { | ||
return { | ||
code, | ||
map: null, | ||
moduleSideEffects: 'no-treeshake', | ||
}; | ||
} | ||
return null; | ||
}, | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix build error