Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive

fix(vite): close vite watcher before building - #5875

Merged
pi0 merged 2 commits into
mainfrom
perf/build-watch
Jul 13, 2022
Merged

fix(vite): close vite watcher before building#5875
pi0 merged 2 commits into
mainfrom
perf/build-watch

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

resolvesnuxt/nuxt#14246

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

We continue watching files during the vite build process, and if (due to a race condition) tsconfig.json is written after vite build starts it can trigger a vite error from the esbuild plugin.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroedanielroe added bug Something isn't working vite labels Jul 13, 2022
@danielroe
danielroe requested a review from antfuJuly 13, 2022 12:03
@danielroedanielroe self-assigned this Jul 13, 2022
@netlify

netlifyBot commented Jul 13, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs canceled.

NameLink
🔨 Latest commitb058b2d
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/62cebe0e2a5cad000838378e

pi0
pi0 approved these changes Jul 13, 2022

@atinuxatinux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you ❤️

ctx.config.plugins.push({
name: 'nuxt:close-vite-watcher',
configureServer (server) {
return server?.watcher?.close()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems like a good workaround but I expect to track this issue. watcher starting for production build is a little bit strange

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

agreed, it seems strange.

what do you think @antfu? should we raise upstream at vite?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should we raise upstream at vite?

Sure if we could provide a reproduction out-side of Nuxt.

Ideally the configureServer shouldn't even be called in build, or we might accidentally have a vite dev server on build?

@pi0
pi0 merged commit 3ad12b5 into mainJul 13, 2022
@pi0
pi0 deleted the perf/build-watch branch July 13, 2022 12:44
@pi0pi0 mentioned this pull request Jul 13, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.xbugSomething isn't workingvite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build error: ERROR [unhandledRejection] Cannot read properties of null (reading 'config')

4 participants

@danielroe@atinux@pi0@antfu