Uxp not defined


I am new to developing plugins so I have been going through some of the tutorials offered in the adobe xd developer documents. Based on what is there I tried to put together a basic image search plugin using some free api’s, however I ran into a problem with uxp.

In order to access the file system I did as is suggested in the tutorials, and put

const fs = require("uxp").storage.localFileSystem;

at the top of my main.js file. When I then try to run the plugin I get a message in the developer console saying “uxp is not defined”.

I have been trying to find a solution for the past couple of days, but have not been able to at all. Any at all help is appreciated.

Thank you!

Welcome to plugin development! I’m sorry that you are experiencing difficulties. First please make sure that you are using a recent release of XD (v36) and your Creative Cloud desktop application is updated as well. I find it helpful to start with an existing working example plugin, then modify it to your needs. This example illustrates how to write to a file in the plugin’s data folder:

If that example also gives you the “uxp is not defined” error, then I think there is a bigger problem that would require reinstalling XD. If it works, then that might help you determine if there is something wrong in your plugin’s code. If you still experience problems then feel free to upload your plugin here and I will help you debug.

Are you using a bundler like webpack by chance? If so, make sure that you declare uxp as an external module.

Thank you for the quick reply and the samples link, I must have missed while reading the tutorials. The sample works perfectly, and after looking through the rest I found the code for the tutorial I was trying to get to work. It looks like what is on the website is slightly different than what is on github. All I needed to do to fix my issue was change the declaration to

const uxp = require("uxp");
const fs = uxp.storage.localFileSystem;

Thank you

1 Like