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(server): do not create server if there is no entry #13612

Closed
wants to merge 4 commits into from

Conversation

btea
Copy link
Collaborator

@btea btea commented Jun 25, 2023

Description

Now even if the entry is not determined, the server will create , and when it is opened directly in the browser, it will appear as shown in the figure below.

Additional context


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 Jun 25, 2023

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

@sun0day
Copy link
Member

sun0day commented Jun 25, 2023

I think it would be better to show a warning instead of throwing an error

@bluwy
Copy link
Member

bluwy commented Jun 25, 2023

Similar to #12096, it'll need a lot more checks and a warning instead of an error to get this right. But it also introduces a glob on every dev startup, and I'm not sure if it's worth the cost.

@btea
Copy link
Collaborator Author

btea commented Jun 25, 2023

In fact, a warning message is currently output when scanImports. However, the server has been created at this time, but as mentioned above, it cannot be accessed, so I want to throw an error message directly before the creation to terminate the server creation.

However, as @bluwy said, this seems to be cumbersome and requires a lot of checking. Currently, I can't pinpoint exactly when an error is thrown such that the test fails.

image

@bluwy
Copy link
Member

bluwy commented Jun 25, 2023

The test fail is coming from ssr-pug because it doesn't have any HTML files. The solution would be configuring the optimizeDeps.entries to JS files instead since Vite doesn't know how to scan pug files. Though even if this is fixed, there's still the perf penalty mentioned before.

For the current import scan warning, it only happens when there's no Vite cache existing, so it'll only happen in cold starts (partly also for performance).

@bluwy
Copy link
Member

bluwy commented Sep 19, 2023

I'll close this for now as there are perf concerns, plus it might likely not working with SSR setups like Vitest that spins up the server and doesn't expect an entrypoint to necessarily exist. Thanks for looking into this!

@bluwy bluwy closed this Sep 19, 2023
@btea btea deleted the fix/create-server-no-entry branch September 19, 2023 11:32
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.

None yet

3 participants