Skip to content

rooDir does not seems to work with JS files #2974

Closed

Description

@NekR

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?

Activity

  1. mhegazy commented on Apr 30, 2015

    @mhegazy
    Contributor

    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?

  2. NekR commented on Apr 30, 2015

    @NekR
    Author

    Mohamed Hegazy (@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 :(

  3. mhegazy commented on Jun 12, 2015

    @mhegazy
    Contributor

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

  4. locked and limited conversation to collaborators on Jun 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions