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
const app = window.require("photoshop").app;
const LayerKind = window.require("photoshop");
app.documents.forEach(document => {
document.layers.forEach(layer => {
if (layer.kind === LayerKind.group) {
console.log(`layer name: ${layer.name}, layer kind: ${layer.kind}`);
}
});
});
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)
any idea on how i can fix all this?