Skip to content

rooDir does not seems to work with JS files #2974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
NekR opened this issue Apr 30, 2015 · 3 comments
Closed

rooDir does not seems to work with JS files #2974

NekR opened this issue Apr 30, 2015 · 3 comments
Labels
Question An issue which isn't directly actionable in code

Comments

@NekR
Copy link

NekR commented Apr 30, 2015

I have following structure

└───src
    ├───external
    │   └───lib
    └───App
        ├───Class

src/external/lib/ contains 2 files, lib.js and lib.d.ts.
In src/App/Class/Class.ts I am importing ../../external/lib/lib and it works fine, but generates following structure:

└───dist
    └───App
        ├───Class

With JS files in dist/App/Class. My config is:

{
  "compilerOptions": {
    "module": "commonjs",
    "sourceMap": false,
    "target": "ES5",
    "noImplicitAny": true,
    "outDir": "./dist",
    "rootDir": "./src"
  },
  "files": [
    "src/main.ts"
  ]
}

So I thought what rootDir property should solve this problem and transfer entire structure to dist folder. Am I doing something wrong?

@mhegazy
Copy link
Contributor

mhegazy commented Apr 30, 2015

The compiler does not copy files. I would add a post build task to copy your dependencies into the output folder.

The issue --rootDir is solving is consistenlly identifiing the root of your files. with out the flag, it is the logest common path of all inputs, that means that something like:

└───src
    └───App
        ├───Class1
        |    └───a.ts
        ├───Class2
              └───b.ts

the output structure without --rootDir will look like:

└───dist
        ├───Class1
        |    └───a.js
        ├───Class2
              └───b.js

with no way of making App show up. --rootDir .\src will cause App to be generated.

Totally off topic, nice tree you have there, how dd generate that?

@mhegazy mhegazy added the Question An issue which isn't directly actionable in code label Apr 30, 2015
@NekR
Copy link
Author

NekR commented Apr 30, 2015

@mhegazy Yep, I originally structured it in a way where external dependencies are living in separate top level folder and src folder contains same tree in external sub-folder with only .d.ts files, but it really feels uncomfortable to have such duplicated structure. So I thought --rootDir might resolve this, sorry if I misunderstood its intention.

Totally off topic, nice tree you have there, how dd generate that?

Windows command tree made it for me. Actually it's not quite useful for big tree since it does not have level parameter :(

@mhegazy
Copy link
Contributor

mhegazy commented Jun 12, 2015

Looks like this is addresses. please reopen if there is missing information.

@mhegazy mhegazy closed this as completed Jun 12, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

2 participants