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

Use relative file location in source maps with relativeSourceLocation enabled #5464

Merged
merged 5 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
init
  • Loading branch information
tjzel committed Dec 4, 2023
commit 24b502d6e8eb7f88681b0e9147b007626dcf75e8
3 changes: 2 additions & 1 deletion plugin/build/plugin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion plugin/src/makeWorklet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export function makeWorklet(
? functionExpression(null, clone.params, clone.body)
: clone;

const [funString, sourceMapString] = buildWorkletString(
let [funString, sourceMapString] = buildWorkletString(
transformed.ast,
variables,
functionName,
Expand Down Expand Up @@ -155,6 +155,11 @@ export function makeWorklet(
let location = state.file.opts.filename;
if (state.opts.relativeSourceLocation) {
location = relative(state.cwd, location);
// It seems there is no designated option to use relative paths in generated sourceMap
sourceMapString = sourceMapString?.replace(
state.file.opts.filename,
location
);
}

initDataObjectExpression.properties.push(
Expand Down