I am updating PS version to 25.2 from 24.1.0 and my plugin stopped working. It would appear that certain paths for require() aren’t valid anymore. For example, I have two .js files:
/js/document/document.js
and /dialogs/newFileDialog/newFileDialog.js
this works: require('./js/document/document.js')
this raises an error: require('./dialogs/newFileDialog/newFileDialog.js')
The error is uninformative. It isnt an error Object, its just the string “-4058” which I think means file not found?
But If I go back to PS 24.1.0, nothing is broken. How do I fix this?
Just kidding, its still broken even if I shorten it.
The solution is that UXP silently enforces a new filepath standard in the fs module.
They decided to change it so that anytime you use the fs module, such as fs.readdir(), you cant use relative paths such as '../my/path' anymore. You have to use 'plugin:/path/to/folder' and always path to things from the plugin root. It would appear you have three options, which are only enumerated in the middle of a paragraph on one doc page, as a passing remark.Here
“plugin:”, “plugin-data:”, and “plugin-temp:”, as well as a native “file:” scheme for the path parameter.
as for what each of those plugin schemes actually map to, its your guess
The file I was trying to require() had a fs.readdir() call in it using relative paths, which are not allowed now. Wish the error messaging would just like, tell me that.