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: Fix broken sourcemap comment generation for .css files #492

Merged
merged 1 commit into from Dec 14, 2021

Conversation

Jastor11
Copy link
Contributor

At the moment .css files generated when the sourcemap flag is true have a sourcemap comment at the bottom of the file that makes the file invalid:

//# sourceMappingURL=index.css.map

As indicated in the MDN docs and the specification for source map, the comment pointing to the source map for CSS files needs to use the /*# sourceMappingURL=/path/to/sourcemap.map */ syntax.

This PR should create a valid sourcemap comment for both .css and .js files. Feel free to adjust the code to fit whatever style makes the most sense for your library.

And of course, thank you for the fantastic library. Exceptionally useful.

At the moment `.css` files generated when the `sourcemap` flag is `true` have a sourcemap comment at the bottom of the file that makes the file invalid:

`//# sourceMappingURL=index.css.map`

As indicated in the MDN [docs](https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Use_a_source_map) and the [specification](https://sourcemaps.info/spec.html#h.lmz475t4mvbx) for source map, the comment pointing to the source map for CSS files needs to use the `/*# sourceMappingURL=/path/to/sourcemap.map */` syntax.

This PR should create a valid sourcemap comment for both `.css` and `.js` files. Feel free to adjust the code to fit whatever style makes the most sense for your library.
@vercel
Copy link

vercel bot commented Dec 14, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/egoist/tsup/Cf1xbvaiUcJojsTTievczX73Gdqp
✅ Preview: https://tsup-git-fork-jastor11-patch-2-egoist.vercel.app

@egoist egoist changed the title Fix broken sourcemap comment generation for .css files fix: Fix broken sourcemap comment generation for .css files Dec 14, 2021
@egoist egoist merged commit 39a3583 into egoist:dev Dec 14, 2021
@github-actions
Copy link

🎉 This PR is included in version 5.11.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants