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: use relative source path in sourcemapIgnoreList #12281

Closed
wants to merge 1 commit into from

Conversation

patak-dev
Copy link
Member

@patak-dev patak-dev commented Mar 3, 2023

Description

Context #12251 (comment)

Calls to sourcemapIgnoreList for vite dev on a create-vite vue ts app after this change

sourcePath: overlay.ts
sourcemapPath: /Users/patak/vite-work/packages/vite/dist/client/client.mjs.map

sourcePath: client.ts
sourcemapPath: /Users/patak/vite-work/packages/vite/dist/client/client.mjs.map

sourcePath: main.ts
sourcemapPath: /Users/patak/test/sourcemap-test/src/main.ts.map

sourcePath: env.ts
sourcemapPath: /Users/patak/vite-work/packages/vite/dist/client/env.mjs.map

sourcePath: App.vue
sourcemapPath: /Users/patak/test/sourcemap-test/src/App.vue.map

sourcePath: HelloWorld.vue
sourcemapPath: /Users/patak/test/sourcemap-test/src/components/HelloWorld.vue.map

cc @bmeurer @danielroe @bluwy


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

@stackblitz
Copy link

stackblitz bot commented Mar 3, 2023

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

@patak-dev patak-dev added this to the 4.2 milestone Mar 3, 2023
@patak-dev patak-dev added the p3-significant High priority enhancement (priority) label Mar 3, 2023
@danielroe
Copy link
Contributor

If this is meant to align with rollup, I'm not sure this is the same thing rollup is doing with regard to the relative paths. Personally, I think absolute sourcePath is more useful for this particular function.

@patak-dev
Copy link
Member Author

This is the same run with rollup:

sourcePath: ../../node_modules/.pnpm/@[email protected]/node_modules/@vue/shared/dist/shared.esm-bundler.js
sourcemapPath: /Users/patak/test/sourcemap-test/dist/assets/index-!~{001}~.js.map

sourcePath: ../../node_modules/.pnpm/@[email protected]/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
sourcemapPath: /Users/patak/test/sourcemap-test/dist/assets/index-!~{001}~.js.map

sourcePath: ../../node_modules/.pnpm/@[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
sourcemapPath: /Users/patak/test/sourcemap-test/dist/assets/index-!~{001}~.js.map

sourcePath: ../../node_modules/.pnpm/@[email protected]/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js
sourcemapPath: /Users/patak/test/sourcemap-test/dist/assets/index-!~{001}~.js.map

sourcePath: ../../../../../../vite.svg
sourcemapPath: /Users/patak/test/sourcemap-test/dist/assets/index-!~{001}~.js.map

sourcePath: ../../src/assets/vue.svg
sourcemapPath: /Users/patak/test/sourcemap-test/dist/assets/index-!~{001}~.js.map

sourcePath: ../../src/components/HelloWorld.vue
sourcemapPath: /Users/patak/test/sourcemap-test/dist/assets/index-!~{001}~.js.map

sourcePath: ../../src/main.ts
sourcemapPath: /Users/patak/test/sourcemap-test/dist/assets/index-!~{001}~.js.map

IIUC, sourcePath is the source relative to the sourcemapPath in rollup. For the dev server, because we mostly have a 1:1 sourcemap to source relationship and the sourcemapPath ends up coinciding with the module, if we align with Rollup as we do in this PR, that would mean that the sourcePath would generally be the filename. So users would mainly need to use sourcemapPath for the condition.

I'm ok if we decide to use absolute paths here, I agree that for the dev server, it is a lot more ergonomic.

@bmeurer
Copy link
Contributor

bmeurer commented Mar 6, 2023

I also think that having absolute paths here is the right thing to do here. If we learn in the future that it'd be beneficial to have (project) relative paths, and there are concrete use cases that don't work with absolute paths, we can always go back and re-investigate.

@patak-dev
Copy link
Member Author

@bluwy if you are ok too with keeping absolute paths, I'll close this PR.

@bluwy
Copy link
Member

bluwy commented Mar 6, 2023

If we have 2 votes going with absolute paths, then I guess we could leave it then 😄 It might be good to note in the docs of the difference with rollup too, and/or note that they are absolute paths by default.

@bmeurer
Copy link
Contributor

bmeurer commented Mar 6, 2023

If we have 2 votes going with absolute paths, then I guess we could leave it then 😄 It might be good to note in the docs of the difference with rollup too, and/or note that they are absolute paths by default.

+1 to updating the docs

@patak-dev
Copy link
Member Author

Ok, I'll send later a PR to clarify that. And we could force absolute path too. Right now, the paths for client.ts and overlay.ts are relative.

@patak-dev patak-dev closed this Mar 6, 2023
@patak-dev patak-dev deleted the fix/relative-paths-for-sourcemap-ignore-list branch March 22, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on hold p3-significant High priority enhancement (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants