duffman / tspath

TypeScript path alias resolver
GNU Lesser General Public License v2.1
151 stars 33 forks source link

outDir should be independent of baseUrl #2

Closed bekker closed 6 years ago

bekker commented 6 years ago

Consider the following tsconfig.json.

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es2016",
        "outDir": "./dist",
        "baseUrl": "./src",
        "paths": {
            "core/*": ["core/*"]
        }
    },
    "exclude": [
        "node_modules",
        "dist"
    ]
}

outDir should be independent of baseUrl, so that resulting output directory is projectRoot/dist, not projectRoot/src/dist.

AFAIK, current implementation searchs for projectRoot/src/dist and throw errors.

duffman commented 6 years ago

Hi bekker! Thanks for your feedback! You are absolutely correct! outDir should by no means have to reflect the dist dir! The reason for this to have happened is lack of testing by that I mean it have done what it´s supposed to in my projects :) I will definitely push a fix for this asap!

et commented 6 years ago

Hi @duffman, any update to this?

duffman commented 6 years ago

Yes, I´ve had the next version running as a beta here and it will become public this weekend :)

2018-02-22 20:42 GMT+01:00 Eric Thomas notifications@github.com:

Hi @duffman https://github.com/duffman, any update to this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/duffman/tspath/issues/2#issuecomment-367797196, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAy_2c4qeWMemT90DAs8JJIo1fVfFjBks5tXcM1gaJpZM4Rluol .

kostanev commented 6 years ago

Same on my case. It tries to find dist inside src which is obviously wrong. It would be nice if the executable accepts parameters instead of asking runtime questions. This way the process can be automated. For example, it can be easily added as a command/task into the "scripts" section in package.json which is a common practice.

duffman commented 6 years ago

Yeah, I know guys, this have taken way to long to get published, I will make a promise here, no later than this Sunday a new version that accepts parameters will be available.

Runtime questions you can skip by using the "-f" parameter, but that is simply an "auto yes"

2018-04-18 20:56 GMT+02:00 Damyan Kostanev notifications@github.com:

Same on my case. It tries to find dist inside src which is obviously wrong. It would be nice if the executable accepts parameters instead of asking runtime questions. This way the process can be automated. For example, it can be easily added as a command/task into the "scripts" section in package.json which is a common practice.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/duffman/tspath/issues/2#issuecomment-382493044, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAy_85H8FUWUXrOTbvWSzqQPja7IGa2ks5tp4x2gaJpZM4Rluol .

jonnyasmar commented 6 years ago

Excellent package! Once this issue is corrected, this should help me finalize a pretty intertwined Serverless deployment I've been trying to figure out for days. Glad I stumbled upon this :)

Looking forward to this fix!

schani commented 6 years ago

I'm hitting this same issue.

ilDon commented 6 years ago

I'm hitting the same issue, for a different scenario.

My baseUrl points to the parent folder "../" (for various reasons), while the out dir points to the dist folder within the main project:

"outDir": "dist",
"baseUrl": "../",

Running tsc produces the correct output in the dist folder, but then tspath looks for the dist folder in the parent folder, e.g.:

tsc points to: ../parent-folder/project-folder/dist
tspath points to: ../parent-folder/dist
ilDon commented 6 years ago

I've created pull request #12 that fixes this issue :-)

duffman commented 6 years ago

Resolved in version 1.3.5

gsusI commented 4 years ago

Possibly back in 1.3.7?

Got

project
  \
    - tsconfig.json
    - package.json
    - src\        //  code
    - build\        //  created by tsc

In tsconfig.json:

    "outDir": "build",
    "baseUrl": "src",

I'm getting the following error:

fs.js:114
    throw err;
    ^

Error: ENOENT: no such file or directory, scandir '<path_to_project>\src\build'

I'm using Windows with Node 10

gsusI commented 4 years ago

Ended up migrating to https://github.com/joonhocho/tscpaths, syntax is very clear and works out-of-the-box.