Skip to content

Change inline-requires to only run when optimizing#9403

Merged
marcins merged 3 commits into
v2from
mszczepanski/inline-requires-on-optimize-only
Nov 26, 2023
Merged

Change inline-requires to only run when optimizing#9403
marcins merged 3 commits into
v2from
mszczepanski/inline-requires-on-optimize-only

Conversation

@marcins

@marcins marcins commented Nov 24, 2023

Copy link
Copy Markdown
Contributor

↪️ Pull Request

Just some minor cleanup.

Changes the plugin so that rather than always running in production mode, will instead only run when doing an optimized build.

Also removes some of the verbose logging, replacing measurement with tracing.

Fixes the example config in README.md.

🚨 Test instructions

Tested manually that it still works with prod builds.

✔️ PR Todo

  • [n/a ] Added/updated unit tests for this change
  • Filled out test instructions (In case there aren't any unit tests)
  • Included links to related issues/PRs

Changes the plugin so that rather than always running in production mode,
will instead only run when doing an optimized build.

Also removes some of the verbose logging, replacing measurement with
tracing.

Fixes the example config in README.md.

@mattcompiles mattcompiles left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice one

@mischnic

mischnic commented Nov 25, 2023

Copy link
Copy Markdown
Member

As far as I understand it, the optimizer only works with scope-hoisting, so checking bundle.env.scopeHoisting would probably be good as well. But you probably simply never use it in that situation 🤷‍♂️

@marcins

marcins commented Nov 26, 2023

Copy link
Copy Markdown
Contributor Author

As far as I understand it, the optimizer only works with scope-hoisting, so checking bundle.env.scopeHoisting would probably be good as well. But you probably simply never use it in that situation 🤷‍♂️

It works regardless of scope hoisting or not - it's actually probably less effective with scope hoisting because there's fewer parcelRequire calls to defer. A more "complete" solution would also need to handle scope hoisted assets and defer their execution too.

@marcins marcins merged commit 65f8e21 into v2 Nov 26, 2023
@mischnic mischnic deleted the mszczepanski/inline-requires-on-optimize-only branch December 2, 2023 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants