i created my first UXP JavaScript plugin using UXP Developer Tool.
im having an issue where i dont know how to properly import modules… for example i want to import LayerKind but i cannot successfully do it using the below
if i use the LayerKind.group like i am up in my code, it doesnt work. when i remove layerkind.group everything works fine.
also when i try to import using
import {LayerKind} from 'photoshop';
i get the below error:
index.js:1 Uncaught SyntaxError: Cannot use import statement outside a module
at e.exports.execScript (uxp://uxp-internal/domjs_scripts.js:2)
at l (uxp://uxp-internal/domjs_scripts.js:2)
at uxp://uxp-internal/domjs_scripts.js:2
at o._executeCallbacks (uxp://uxp-internal/domjs_scripts.js:2)
at o._executeIfReady (uxp://uxp-internal/domjs_scripts.js:2)
at Array. (uxp://uxp-internal/domjs_scripts.js:2)
at o._executeCallbacks (uxp://uxp-internal/domjs_scripts.js:2)
at o.done (uxp://uxp-internal/domjs_scripts.js:2)
at Object.s [as loadHtmlContent] (uxp://uxp-internal/domjs_scripts.js:2)
at Object._loadHtmlContent (uxp://uxp-internal/p…anager_scripts.js:1)
I don’t know where the LayerKind obj is. I think its an enum but I’m not really good at finding out all these things. That’s why I’m here asking for help
Just double-checked the actual constants object, LayerKind is missing indeed.
Not sure if they forgot to add it, but layer.kind already changed from a number to a string:
it works just fine. Still, very strange that i have to create this object… i would assume it was already in UXP. I just hope i dont run into more things that are “not complete”. I have some legacy scripts that are crashing photoshop. need to upgrade. But either way, it works for now. im glad at least i got to the bottom of it. hopefully it will be added soon. Thank you guys for all your help