8000 feat: add support for generating sourcemaps by bryan-hoang · Pull Request #276 · unjs/mkdist · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: add support for generating sourcemaps #276

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bryan-hoang
Copy link
@bryan-hoang bryan-hoang commented Dec 20, 2024

Resolves #164

The CLI now accepts a --sourcemap option that should match the behaviour of esbuild's --sourcemap option. The programmatic API's esbuild.sourcemap option should now also match with esbuild's sourcemap option for the Build API.

The sourcemap: 'linked' option is special cased in the implementation, since esbuild doesn't support the option under the Transform API that mkdist uses 1.

Refs: https://esbuild.github.io/api/#sourcemap
Refs: https://sourcemaps.info/spec.html

Footnotes

  1. https://github.com/evanw/esbuild/blob/745abd9f0c06f73ca40fbe198546a9bc36c23b81/pkg/api/api_impl.go#L1749

Comment on lines +291 to +278
"dist/components/script-multi-block.vue.mjs.map",
"dist/components/script-setup-ts.vue",
"dist/components/script-setup-ts.vue.mjs.map",
"dist/components/ts.vue",
"dist/components/ts.vue.mjs.map",
Copy link
Author

Choose a reason for hiding this comment

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

I'm unsure about the generation of the *.vue.mjs.map files, as I haven't worked with .vue files before.

const { writtenFiles } = await mkdist({
rootDir,
esbuild: {
sourcemap: "linked",
Copy link
Author
@bryan-hoang bryan-hoang Dec 20, 2024

Choose a reason for hiding this comment

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

I only added a test case with the "linked" option since that's what I'm personally interested in, and I wasn't sure how the option would change if esbuild were to be swapped out with rolldown in the future. I'd be happy to add test cases for the other modes if deemed necessary.

@bryan-hoang bryan-hoang force-pushed the feature/sourcemap-generation branch from f9d2746 to 40bded1 Compare December 20, 2024 19:28
@bryan-hoang bryan-hoang force-pushed the feature/sourcemap-generation branch from 4f295d5 to d8f7dc5 Compare December 31, 2024 16:48
@bryan-hoang bryan-hoang force-pushed the feature/sourcemap-generation branch from d8f7dc5 to 195970b Compare January 14, 2025 20:06
@bryan-hoang bryan-hoang force-pushed the feature/sourcemap-generation branch from 195970b to 9f925ec Compare February 12, 2025 16:44
@bryan-hoang bryan-hoang force-pushed the feature/sourcemap-generation branch from 976f475 to 93f1f41 Compare February 24, 2025 20:06
The CLI now accepts a `--sourcemap` option that should match the
behaviour of `esbuild`'s `--sourcemap` option. The programmatic API's
`esbuild.sourcemap` option should now also match with `esbuild`'s
`sourcemap` option for the Build API.

The `sourcemap: 'linked'` option is special cased in the implementation,
since `esbuild` doesn't support the option under the Transform API that
`mkdist` uses [^1].

Refs: https://esbuild.github.io/api/#sourcemap
Refs: https://sourcemaps.info/spec.html

[^1]: https://github.com/evanw/esbuild/blob/745abd9f0c06f73ca40fbe198546a9bc36c23b81/pkg/api/api_impl.go#L1749
@bryan-hoang bryan-hoang force-pushed the feature/sourcemap-generation branch from 93f1f41 to 55518c0 Compare March 21, 2025 19:19
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.

Sourcemap generation support
1 participant
0