Document.save stop support on photoshop latest 24.1.0

Hi everyone,
When trying write a plugin UXP and test on photoshop ver 24.1.0, I got the message box error:

error1

After several times, I figure out that I used the command: document.save(); instead of batchPlay.
I think I will change that script to use the batchPlay for UXP plugin.

Code:

import * as Photoshop from “photoshop”;
//hard code for first document of the list document has opened on photoshop (actived document)
const document = Photoshop.app.documents[0];

=> but for CEP extensions, I have only solution is use document.save();
If end-user use CEP extension on window and trying to open photoshop ver 24.1.0 => it’s will push the error message.

Any idea for this case? offical document or blog post for the update of the photoshop.

Thank in advanced.

I trying to use Photoshop ExtendScript instead of document, old but gold :smiley: thank everyone.

If I remember correctly, UXP doesn’t allow ESM imports and you have to use CommonJS instead, eg:
const { app } = require("photoshop")

1 Like

Or in this case I guess this would also work? At least I use it like this in all my UXP plugins

import { app } from "photoshop"

Don’t know what is ESM, so maybe I’m talking nonsense here :sweat_smile:

@Karmalakas that’s ESM! I was under the impression that UXP couldn’t handle them natively and required the use of Webpack or similar to bundle up first.

More on ESM vs CJS

1 Like

Oh, so this works only with Webpack in UXP? Then ignore my comment - I use Webpack :sweat_smile:

Possibly, if I’m honest Webpack is some dark magic I seem to have accidentally got to do what I want without understanding it fully :rofl:

1 Like

@Lichhuun in case you missed the gist of all that - try using Common JS imports instead of ESM (see thread above for more details).
As I understand it, ExtendScript is going to be mothballed completely and replaced with UXP and so your workaround will eventually cease to work.

Yeah, my solution just finished the situation of the user. I may try the new one better.
Thanks