Skip to content

Babel parses and removes sourceMappingURL from input #9790

@also

Description

@also

Bug Report

Current Behavior

I have some code that generates JavaScript files and includes the string //# sourceMappingURL=. Babel appears to remove this string and the remainder of the line before parsing.

Input Code

const comment = `//# sourceMappingURL=${path.basename(
  sourceMapFilename
)}`

Babel REPL

Output Code

const comment = `
  sourceMapFilename
)}`;

Expected behavior/code

//# sourceMappingURL= should not have special meaning inside of a template literal, and should be included in the generated output

const comment = `//# sourceMappingURL=${path.basename(sourceMapFilename)}`;

Babel Configuration (.babelrc, package.json, cli command)

None, see REPL link.

Environment

  • Babel version(s): v7.4.2
  • How you are using Babel: repl

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions