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

Minify DEV bundles with closure #29809

Merged
merged 1 commit into from
Jun 8, 2024
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
1 change: 1 addition & 0 deletions packages/shared/CheckStringCoercion.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function willCoercionThrow(value: mixed): boolean {
}
}

/** @noinline */
Copy link
Collaborator Author

@sebmarkbage sebmarkbage Jun 7, 2024

Choose a reason for hiding this comment

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

This is a fun one. Closure doesn't think '' + can throw so it DCE this whole set of warnings. We'll have to watch out for stuff like that. Avoiding the inlining fixes that.

Luckily this was caught by build tests.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Does Closure keep this comment? I remember we had a similar one in warning() but not sure if it’s gone now.

function testStringCoercion(value: mixed) {
// If you ended up here by following an exception call stack, here's what's
// happened: you supplied an object or symbol value to React (as a prop, key,
Expand Down
3 changes: 2 additions & 1 deletion scripts/rollup/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ function getPlugins(
const isProduction = isProductionBundleType(bundleType);
const isProfiling = isProfilingBundleType(bundleType);

const needsMinifiedByClosure = isProduction && bundleType !== ESM_PROD;
const needsMinifiedByClosure =
bundleType !== ESM_PROD && bundleType !== ESM_DEV;

return [
// Keep dynamic imports as externals
Expand Down