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: ensure deps optimizer first run, fixes #8750 #8775

Merged
merged 3 commits into from Jun 26, 2022

Conversation

patak-dev
Copy link
Member

Description

Alternative to:

@sapphi-red thanks for the research on #8760, I think we could go with this implementation. What do you think?


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

@netlify
Copy link

netlify bot commented Jun 24, 2022

Deploy Preview for vite-docs-main canceled.

Name Link
🔨 Latest commit f381c7d
🔍 Latest deploy log https://app.netlify.com/sites/vite-docs-main/deploys/62b87089aee0a700095c3e36

@patak-dev patak-dev added p3-downstream-blocker 🔨 Blocking the downstream ecosystem to work properly (priority) feat: deps optimizer Esbuild Dependencies Optimization labels Jun 24, 2022
sapphi-red
sapphi-red previously approved these changes Jun 25, 2022
Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

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

Nice! I didn't notice firstRunCalled.
LGTM

@patak-dev
Copy link
Member Author

The windows fails looks legit, I'll check if we need to move this later (when resolving the ids, instead on buildStart)

@sapphi-red
Copy link
Member

sapphi-red commented Jun 25, 2022

If we are going to do this in resolveId, IIRC this would work. (this is the first way I tried)

    resolveId(id, importer) {
      if (getDepsOptimizer(config)?.isOptimizedDepFile(id)) {
        return id
      }
      // entrypoints
      if (importer === undefined) {
        getDepsOptimizer(config)?.delayDepsOptimizerUntil(id, async () => {})
      }
    },

@patak-dev
Copy link
Member Author

Oh, right, getDepsOptimizer(config)?.delayDepsOptimizerUntil(id, async () => {}) is ok because there is a debounce after the registered ids are empty. It should be an else though 🤔

@patak-dev patak-dev merged commit 3f689a4 into main Jun 26, 2022
@patak-dev patak-dev deleted the fix/ensure-deps-optimizer-run branch June 26, 2022 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: deps optimizer Esbuild Dependencies Optimization 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