Skip to content

UXP Debugging Setup#52

Open
justintaylor-dev wants to merge 4 commits intomasterfrom
uxp-debugging
Open

UXP Debugging Setup#52
justintaylor-dev wants to merge 4 commits intomasterfrom
uxp-debugging

Conversation

@justintaylor-dev
Copy link
Copy Markdown
Contributor

No description provided.

Comment on lines +218 to +241
outputOptions(options) {
const projectRoot = process.cwd();
const originalTransform = options.sourcemapPathTransform;
options.sourcemapPathTransform = (relativeSourcePath, sourcemapPath) => {
let finalPath = relativeSourcePath;

// Preserve the user's custom transform if they defined one in the config
if (typeof originalTransform === "function") {
finalPath =
originalTransform(relativeSourcePath, sourcemapPath) || finalPath;
}

const mapDir = path.dirname(sourcemapPath);

// Calculate the exact path from the project root
const absoluteSourcePath = path.resolve(mapDir, finalPath);
const relativeToRoot = path.relative(projectRoot, absoluteSourcePath);
const cleanPath = relativeToRoot.replace(/\\/g, "/");

return `uxp-plugin://${cleanPath}`;
};

return options;
},
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I am not sure you need this. I seen you Bolt generated valid relative path by default. It even mapped correctly.

Or is it for a different purpose?

sourcemap: mode && ["dev", "build"].includes(mode) ? "inline" : false,
// sourcemap: mode && ["dev", "build"].includes(mode) ? true : false,
minify: false,
emptyOutDir: !shouldNotEmptyDir,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Setting this to "false" did the trick for me to stop cleaning .uxprc file. Of course it is only workaround. If you would like to keep functionality you would probably have to do custom cleaning plugin and hook it in bundler lifecycle.

The ultimate goal is to convince Adobe to add websocket endpoint to the UXP service to subscribe plugins list instead of relying on temporary files and patch. But that could take a long time.

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.

2 participants