-
Notifications
You must be signed in to change notification settings - Fork 49.7k
Closed as not planned
Closed as not planned
Copy link
Labels
Resolution: StaleAutomatically closed due to inactivityAutomatically closed due to inactivityStatus: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug
Description
React version: N/A (Build tooling issue on main as of commit 0131d0c )
Steps To Reproduce
- Clone, install, and run
yarn build - Inspect
build/oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js - Scroll to line 300, around
var reservedProps =. Compare withreact-dom-bindings/src/shared/DOMProperty.js. Note that:
- There is no
propertiesobject in the build output - The lines that should say
properties[name] = new PropertyInfoRecord(....)are missing the assignment, and only saynew PropertyInfoRecord() - A couple of the associated constants like
const RESERVED = 0are also missing
This appears to be a bug in Rollup's tree-shaking behavior. If the Rollup config in build.js is modified to say moduleSideEffects: 'safest', the missing content appears in these bundles.
Per experimentation, this can be addressed by adding a custom Rollup plugin that specifically tells Rollup "this code has side effects, don't tree-shake it" (based on rollup/rollup#4090 (comment) ):
module.exports = function disableTreeshake() {
return {
name: 'scripts/rollup/plugins/disable-treeshake',
transform(code, id) {
// Fix issue with `react-dom-webpack-server` bundles accidentally
// stripping out the `properties` object and not filling it out
if (id.endsWith('DOMProperty.js')) {
return {
code,
map: null,
moduleSideEffects: 'no-treeshake',
};
}
return null;
},
};
};Link to code example:
The current behavior
The full code from DOMProperty.js does not show up in those react-dom-webpack-server bundles
The expected behavior
The DOMProperty output should show up.
Metadata
Metadata
Assignees
Labels
Resolution: StaleAutomatically closed due to inactivityAutomatically closed due to inactivityStatus: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug