ExtendScript / extendscriptr

An NPM command line tool to compile modern javascript (es5 & es6) into executable extendscript (es3)
Do What The F*ck You Want To Public License
153 stars 15 forks source link

module-alias support #67

Open ZollieDev opened 3 years ago

ZollieDev commented 3 years ago

I've been unable to get extendscriptr to run in tandem with module-alias. My application is just the boilerplate, and I'd like to add module-alias so that I can better manage require paths as the application scales. Open to suggestions if I'm headed down an odd path or if this is the wrong communication channel. Thanks for taking the time.

app.js

// this errors when the jsx is run
require('module-alias/register')
$.writeln("@test")

// this runs, but "@test2" will be printed rather than "test2", suggesting moduleAlias didn't do its thing
const moduleAlias = require('module-alias')
moduleAlias.addAlias("@test2", "test2")
$.writeln("@test2")

package.json

{
    "scripts": {
        "setup": "mkdir dist ; touch dist/app.jsx",
        "build": "extendscriptr --script ./src/app.js --output ./dist/app.jsx"
    },
    "devDependencies": {
        "extendscriptr": "^1.2.6"
    },
    "dependencies": {
        "module-alias": "^2.2.2"
    },
    "_moduleAliases": {
        "@test": "test"
    }
}