Copy link to clipboard
Copied
Is there a way to import a custom libraries into Illustrator despite older JS?
Copy link to clipboard
Copied
can you elaborate? this seems very similar to your other question
Copy link to clipboard
Copied
It is similiar but in this case I'd like to import a library called 'random-word-slugs.js' but using `#include` returns a "I/O Error".
Copy link to clipboard
Copied
try copying the contents of your library and pasting it manually on top of your script (not using #include) just to see if it works. The errors might be caused by the use of modern javascript. Once the library and the script are in one file, hopefully you can debug and pin point what the problem is. Obviously you have to remove all new code and make your library ES3 compliant.
Copy link to clipboard
Copied
I ended up coping over the necessary material from the library into a dedicated json file that I can use. Thanks for your fast replies nontheless!š
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Generally speaking you can't use import or require keywords to do it directly, but you could use a transpiler like Babel to convert it from modern JS down to IE standards. There are no poly or ponyfills for modules like fs or Promises unless you'd make them, though
Copy link to clipboard
Copied
For an example of what I mean with a core babel loader and a few plugins for using things like template literals and arrow functions, see here.
Typescript can also help with this with the right compiling options.