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: specify sourceFileName when generating inline sourcemaps #10797

Merged
merged 1 commit into from Feb 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions packages/babel-standalone/src/transformScriptTags.js
Expand Up @@ -26,25 +26,24 @@ function transformCode(transformFn, script) {
}
}

return transformFn(script.content, {
filename: source,
...buildBabelOptions(script),
}).code;
return transformFn(script.content, buildBabelOptions(script, source)).code;
}

/**
* Builds the Babel options for transforming the specified script, using some
* sensible default presets and plugins if none were explicitly provided.
*/
function buildBabelOptions(script) {
function buildBabelOptions(script, filename) {
return {
filename,
presets: script.presets || ["react", "es2015"],
plugins: script.plugins || [
"proposal-class-properties",
"proposal-object-rest-spread",
"transform-flow-strip-types",
],
sourceMaps: "inline",
sourceFileName: filename,
};
}

Expand Down