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

Don't output source maps if sourceMaps option is omitted or false #74

Closed
wants to merge 1 commit into from

Conversation

stefee
Copy link

@stefee stefee commented Oct 8, 2021

Closes #73

Reverts regression in #68

sourceMaps: undefined | swc.Options['sourceMaps']
sourceMaps: swc.Options['sourceMaps']
Copy link
Author

Choose a reason for hiding this comment

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

undefined | isn't needed because swc.Options['sourceMaps'] is already optional

@@ -11,7 +11,7 @@ const {
} = promises;

function withSourceMap(output: Output, options: Options, destFile: string, destDir: string) {
if (!output.map || options.sourceMaps === "inline") {
if (!output.map || !options.sourceMaps || options.sourceMaps === "inline") {
Copy link
Member

Choose a reason for hiding this comment

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

This will @swc/cli not generate sourcemap even if sourceMaps: true is specified in .swcrc.

Copy link
Author

Choose a reason for hiding this comment

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

I see - the issue must be swc core is not reading the sourceMaps: false from swcrc file correctly (and it must also be default to true not false)

) {
const destDir = dirname(filename);
mkdirSync(destDir, { recursive: true });

let code = output.code;
if (output.map && sourceMaps !== "inline") {
if (output.map && sourceMaps && sourceMaps !== "inline") {
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

@stefee stefee closed this Oct 8, 2021
@stefee stefee deleted the issue-73 branch October 8, 2021 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Unable to disable source maps
2 participants