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(client): serve client sources next to deployed scripts #11865

Merged
merged 1 commit into from
Feb 1, 2023

Conversation

bmeurer
Copy link
Contributor

@bmeurer bmeurer commented Jan 31, 2023

Description

As detailed in https://crbug.com/1411596, Vite currently serves its own client sources under <origin>/src/client/*.ts, which is confusing for developers that expect to find only their own code within /src/.

Ideally the client.ts, overlay.ts, and env.ts would just appear next to their deployed counterparts, which can be accomplished by making sure that the sourcemaps generated by rollup contain only the file name without any additional relative path (which the DevTools will not be able to resolve meaningfully for at least /@vite/client).

Additional context

Ref: https://crbug.com/1411596
Demo: https://github.com/jecfish/coffee-cart (@jecfish)


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.

As detailed in https://crbug.com/1411596, Vite currently serves its own
client sources under `<origin>/src/client/*.ts`, which is confusing for
developers that expect to find only their own code within `/src/`.

Ideally the `client.ts`, `overlay.ts`, and `env.ts` would just appear
next to their deployed counterparts, which can be accomplished by
making sure that the sourcemaps generated by rollup contain only the
file name without any additional relative path (which the DevTools
will not be able to resolve meaningfully for at least `/@vite/client`).

Ref: https://crbug.com/1411596
Demo: https://github.com/jecfish/coffee-cart
Copy link
Member

@patak-dev patak-dev left a comment

Choose a reason for hiding this comment

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

Looks good to me, I think we could merge it before releasing 4.1.

@patak-dev patak-dev added the p3-significant High priority enhancement (priority) label Jan 31, 2023
@patak-dev patak-dev added this to the 4.1 milestone Jan 31, 2023
@dominikg
Copy link
Contributor

/ecosystem-ci run

@vite-ecosystem-ci
Copy link

vite-ecosystem-ci bot commented Jan 31, 2023

📝 Ran ecosystem CI: Open

suite result
astro ✅ success
histoire ❌ failure
iles ✅ success
ladle ✅ success
laravel ✅ success
marko ✅ success
nuxt-framework ✅ success
previewjs ✅ success
qwik ❌ failure
rakkas ✅ success
sveltekit ❌ failure
vite-plugin-ssr ✅ success
vite-plugin-react ✅ success
vite-plugin-react-pages ✅ success
vite-plugin-react-swc ✅ success
vite-plugin-svelte ✅ success
vite-plugin-vue ✅ success
vite-setup-catalogue ✅ success
vitepress ✅ success
vitest ✅ success
windicss ✅ success

@patak-dev patak-dev merged commit 63bd261 into vitejs:main Feb 1, 2023
futurGH pushed a commit to futurGH/vite that referenced this pull request Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-significant High priority enhancement (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants