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(sourcemap): improve sourcemap compatibility for vue2 #16594

Merged
merged 2 commits into from May 5, 2024

Conversation

amweiss
Copy link
Contributor

@amweiss amweiss commented May 4, 2024

Description

This change does match what was in #16192 but that is marked as not resolving a different problem, so I didn't want to conflate things.

Thile using vue2, and specifically the vue2-google-maps package which contains a vue component, the build process produces a resolvedSourcePath that contains query string style arguements such as:

/home/adam/repos/vue2-map/node_modules/node_modules/.pnpm/[email protected]/node_modules/vue2-google-maps/dist/components/placeInputImpl.js?v=c006e476&vue&type=script&src=true&lang.js

This then leads to a missingSources entry since the characters after the extension do not allow for the file to be loaded such as:

Sourcemap for "/home/adam/repos/vue2-map/node_modules/.pnpm/[email protected]/node_modules/vue2-google-maps/dist/components/placeInputImpl.js" points to missing source files

By first converting the URI to a filesystem path, we can ensure it loads the file.

Copy link

stackblitz bot commented May 4, 2024

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

@amweiss amweiss changed the title feat: Improve sourcemap compatibility for vue2 feat: improve sourcemap compatibility for vue2 May 4, 2024
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.

Thanks!

packages/vite/src/node/server/sourcemap.ts Outdated Show resolved Hide resolved
@sapphi-red sapphi-red changed the title feat: improve sourcemap compatibility for vue2 fix: improve sourcemap compatibility for vue2 May 4, 2024
@sapphi-red sapphi-red changed the title fix: improve sourcemap compatibility for vue2 fix(sourcemap): improve sourcemap compatibility for vue2 May 4, 2024
@sapphi-red sapphi-red added p2-edge-case Bug, but has workaround or limited in scope (priority) feat: sourcemap Sourcemap support labels May 4, 2024
@patak-dev patak-dev merged commit 913c040 into vitejs:main May 5, 2024
11 checks passed
@amweiss amweiss deleted the vue2-sourcemaps-compat branch May 5, 2024 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: sourcemap Sourcemap support p2-edge-case Bug, but has workaround or limited in scope (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants