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

fix: early discovery of missing deps, fix #7333 #7346

Merged
merged 1 commit into from Mar 16, 2022

Conversation

patak-dev
Copy link
Member

@patak-dev patak-dev commented Mar 16, 2022

Description

Related #7345

This PR moves the rewrite of URL imports to happen after the eager transformation of imported modules. These rewrites need to know if es interop is needed, so awaiting for them is blocked by pre-bundling processing. After this PR, missing dependencies can be discovered in batch avoiding full reloads. This also allows Vite to process more requests while dependencies are being pre-bundled on cold start.

#7333 worked fine with beta-0 because invalidation wasn't being handled properly, with beta-2 and a file like:

import format from 'date-fns/format/index.js';
import getYear from 'date-fns/getYear/index.js';
import getMonth from 'date-fns/getMonth/index.js';
import getQuarter from 'date-fns/getQuarter/index.js';
import getDay from 'date-fns/getDay/index.js';
import isAfter from 'date-fns/isAfter/index.js';
import isBefore from 'date-fns/isBefore/index.js';
import isEqual from 'date-fns/isEqual/index.js';

When each import was analyzed, the new dep will be discovered but import analysis will be blocked until we know if it needs es-interop... and because a full reload was needed, each new import in this file will end up generating a full reload.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

@patak-dev patak-dev mentioned this pull request Mar 16, 2022
4 tasks
@patak-dev
Copy link
Member Author

Merging as this is still conceptually part of the work in #6758, so we can release a new patch and continue testing during the beta

@patak-dev patak-dev merged commit 7d2f37c into main Mar 16, 2022
@patak-dev patak-dev deleted the fix/early-discovery-of-missing-deps branch March 16, 2022 11:51
@patak-dev patak-dev added the p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority) label Mar 16, 2022
@patak-dev patak-dev added this to the 2.9 milestone Mar 16, 2022
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants