ilearnio / module-alias

Register aliases of directories and custom module paths in Node
MIT License
1.76k stars 69 forks source link

Allow Multiple path for an alias in package.json #140

Open codad5 opened 1 year ago

codad5 commented 1 year ago

Just like typescript path alias, where multiple paths can be tied to an alias make it possible to do so in the package.json

/* other tsconfig,json setting */
"moduleResolution": "node",                       /* Specify how TypeScript looks up a file from a given module specifier. */
    "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
    "paths": {
      "@/*": [
        "./src/*", 
        "./dist/*"
      ],
    }, /* Specify a set of entries that re-map imports to additional lookup locations. */

make it same for package.json where the build and src path could differ Something like this

"main": "dist/server.js",
  "_moduleAliases": {
    "@": ["src", "dist"]
  },