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

[feat] add enableSourcemap option #6835

Merged
merged 8 commits into from
Oct 17, 2021
Merged

[feat] add enableSourcemap option #6835

merged 8 commits into from
Oct 17, 2021

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Oct 11, 2021

Supersedes #6744
Part of the fix for sveltejs/kit#720

This allows us to control the generation of sourcemaps for compile. This is non-breaking. Implementation-wise is quite simple and doesn't provide too much perf boost. The idea is to achieve #6744 but in a more generic way.

Option type:

{
  enableSourcemap: boolean | { js: boolean; css: boolean; } // default true
}

Note: This new option was discussed in the last maintainer's meeting (suggested by @lukeed), the plan is to have vite-plugin-svelte disable CSS sourcemaps for SSR only to fix sveltejs/kit#720.

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with [feat], [fix], [chore], or [docs].
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with npm test and lint the project with npm run lint

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Copy link
Member

@Conduitry Conduitry left a comment

Choose a reason for hiding this comment

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

Passing in strings to enable just CSS or just JS sourcemaps feels like a weird API to me. I think I'd prefer passing either a boolean (which controls everything) or an object with css and js keys which can have boolean values.

@bluwy
Copy link
Member Author

bluwy commented Oct 13, 2021

Passing in strings to enable just CSS or just JS sourcemaps feels like a weird API to me. I think I'd prefer passing either a boolean (which controls everything) or an object with css and js keys which can have boolean values.

That was actually the initial proposal and I derailed from there 😅 Updated with the boolean | { js: boolean; css: boolean; } type.

@Conduitry Conduitry merged commit be1eff0 into sveltejs:master Oct 17, 2021
@bluwy bluwy deleted the feat-sourcemap-option branch October 17, 2021 17:35
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.

Environment variables in Svelte templates don't work with npm run build
3 participants