question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

outDir is not taking into account

See original GitHub issue

Hi

likely my mistake, but I did not get it to work.

I have the following configuration (just keep relevant fields)

{
    "include": [
        "../../eikon-framework/src/**/*.ts"
    ],
    "compilerOptions": {
        "baseUrl": ".",
        "paths": {
            "df-core/*": ["./build/df-core/*"],
            "*": [
                "./node_modules/*",
                "./node_modules/@types/*"
            ]
        },
        "rootDir": "../../eikon-framework/src",
        "outDir": "./build/eikon-framework"
    }
}

I have the following file: …/…/src/eikon-framework/src/auth/auth-impl.ts import { GetElectronEnvironment } from 'df-core/env';

after the compilation in the outDir folder I have [outDir]/eikon-framework/auth/auth-impl.js const env_1 = require("../../../products/workspace/build/df-core/env/index");

It seems the resolution has been done from the original location of TS file and not from the output location of JS file. With “df-core/“: [”./build/df-core/”] and outDir = ./build/eikon-framework/auth/auth-impl.js

I would expect const env_1 = require("../../df-core/env/index");

Could you help me please

Thanks

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
danielpzacommented, Jun 8, 2021

@couellet I think you need 2 entries in the plugin section for the transformer to actually work:

https://github.com/LeDDGroup/typescript-transform-paths#example-config

    "plugins": [
      { "transform": "typescript-transform-paths", "useRootDirs": true },
      { "transform": "typescript-transform-paths", "useRootDirs": true, "afterDeclarations": true }
    ]
1reaction
emmkimmecommented, May 11, 2021

Looking at your code and debugging the plugin, I found a way to deal with rootDirs.

{
    "include": [
        "../../eikon-framework/src/**/*.ts"
    ],
    "compilerOptions": {
        "rootDirs": ["./build/", "../../eikon-framework"],
        "baseUrl": ".",
        "paths": {
            "df-core/*": ["./build/df-core/*"],
            "*": [
                "./node_modules/*",
                "./node_modules/@types/*"
            ]
        },
        "rootDir": "../../eikon-framework/src",
        "outDir": "./build/eikon-framework"
    }
}

I’m wondering if we could have another way just using ‘paths’, ‘rootDir’ and ‘outDir’ to achieve the same. I have the feeling to duplicate the information.

Feel free to close this issue and thanks for your help and for this plugin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

typescript outDir setting in tsconfig.json not working
When running the tsc command on the index file, it creates a new one beside it instead of in the build directory. What...
Read more >
tsc says "No inputs were found" when "outDir": "." · Issue #41734
I get an error message about "No inputs were found" if I have the below in my tsconfig.json . This is extremely confusing...
Read more >
Documentation - tsc CLI Options - TypeScript
Flag Type Default ‑‑allowJs boolean false ‑‑allowUmdGlobalAccess boolean false ‑‑allowUnreachableCode boolean
Read more >
$(OutDir) Does not match Output Directory ? - Microsoft Q&A
Hi, and thanks for your help! To my confusion when I looked into the macros tody the $(OutDir) was correct - it was...
Read more >
Typescript and tsconfig; outDir and rootDir is not respected in ...
Debugging of TypeScript and discovering of Mocha tests should work with outDir + rootDir in tsconfig. Actual Behavior. Throws an error complaining that ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found