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(config): watch envDir even outside of root #12349

Merged
merged 2 commits into from Mar 10, 2023

Conversation

fi3ework
Copy link
Member

@fi3ework fi3ework commented Mar 9, 2023

Description

a repro: https://stackblitz.com/edit/vitejs-vite-ux3kxh?file=.env. Modify .env and the server will not restart (Ideally it should).

When envDir is out of resolvedConfig.root, it won't be watched.

Additional context

Annotate envDir as an internal field as it's not required by user so far (I guess :P)
And, I belileve after this PR, we have watched all the things that could trigger a server restart.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@stackblitz
Copy link

stackblitz bot commented Mar 9, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

patak-dev
patak-dev previously approved these changes Mar 9, 2023
Comment on lines 345 to 346
/** @internal */
envDir: string
Copy link
Member

Choose a reason for hiding this comment

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

I think it's safe enough to not need to make this internal. Currently, ResolvedConfig has envDir?: string | undefined, this would make a previous public API internal, which is sort-of a breaking change.

Removing the /** @internal */ comment should be good.

Suggested change
/** @internal */
envDir: string
envDir: string

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated. nice catch. I feel even more that we need some type checking (maybe leverage tsd). I'll give it a try.

@bluwy bluwy added the p3-minor-bug An edge case that only affects very specific usage (priority) label Mar 10, 2023
@fi3ework fi3ework requested review from bluwy and patak-dev and removed request for bluwy and patak-dev March 10, 2023 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants