Skip to content

feat(minifier): constant evaluate .toLowerCase().startsWith('prod');#12027

Merged
graphite-app[bot] merged 1 commit intomainfrom
07-02-feat_minifier_constant_evaluate_.tolowercase_.startswith_prod_
Jul 2, 2025
Merged

feat(minifier): constant evaluate .toLowerCase().startsWith('prod');#12027
graphite-app[bot] merged 1 commit intomainfrom
07-02-feat_minifier_constant_evaluate_.tolowercase_.startswith_prod_

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Jul 2, 2025

For the popular library https://github.com/benmccann/esm-env/blob/esm-env%401.2.2/packages/esm-env/dev-fallback.js

const node_env = globalThis.process?.env?.NODE_ENV;
export default node_env && !node_env.toLowerCase().startsWith('prod');

If define plugin changes node_env to production:

const node_env = 'production';
export default node_env && !node_env.toLowerCase().startsWith('prod');

yields

const node_env = 'production';
export default !1;

closes #11978

@github-actions github-actions bot added the A-minifier Area - Minifier label Jul 2, 2025
Copy link
Member Author

Boshen commented Jul 2, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added the C-enhancement Category - New feature or request label Jul 2, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Jul 2, 2025

CodSpeed Instrumentation Performance Report

Merging #12027 will improve performances by 29.89%

Comparing 07-02-feat_minifier_constant_evaluate_.tolowercase_.startswith_prod_ (b44386e) with main (619ba2e)

Summary

⚡ 1 improvements
✅ 37 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
mangler[cal.com.tsx] 3.5 ms 2.7 ms +29.89%

@graphite-app
Copy link
Contributor

graphite-app bot commented Jul 2, 2025

Merge activity

#12027)

For the popular library https://github.com/benmccann/esm-env/blob/esm-env%401.2.2/packages/esm-env/dev-fallback.js

```js
const node_env = globalThis.process?.env?.NODE_ENV;
export default node_env && !node_env.toLowerCase().startsWith('prod');
```

If define plugin changes `node_env` to `production`:

```js
const node_env = 'production';
export default node_env && !node_env.toLowerCase().startsWith('prod');
```

yields

```js
const node_env = 'production';
export default !1;
```

closes #11978
@graphite-app graphite-app bot force-pushed the 07-02-feat_minifier_constant_evaluate_.tolowercase_.startswith_prod_ branch from c139cd2 to b44386e Compare July 2, 2025 08:09
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Jul 2, 2025
@graphite-app graphite-app bot merged commit b44386e into main Jul 2, 2025
24 checks passed
@graphite-app graphite-app bot deleted the 07-02-feat_minifier_constant_evaluate_.tolowercase_.startswith_prod_ branch July 2, 2025 08:16
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-minifier Area - Minifier C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

minifier: constant evaluate .toLowerCase().startsWith('prod');

1 participant