Skip to content

paths & baseUrl is not supported in typescript? #16088

@azarus

Description

@azarus

Soo according to the documentation here:
https://www.typescriptlang.org/docs/handbook/module-resolution.html

And this proposal here:
#5039

I've tried to set up a simple typescript project using the paths and baseUrl path mapping to create shortcuts to folders.

Everything seemed fine in vscode but when i executed tsc from the commandline i found out its not working properly.

TypeScript Version:
Version 2.3.3

Code
tsconfig.json

{
  "compilerOptions": {
    "outDir": "./build/assets/js/",
    "sourceMap": true,
    "noImplicitAny": true,
    "module": "commonjs",
    "target": "es5",
    "allowJs": true,
    "baseUrl": "",
    "paths": {
        "@Core/*": [
            "source/Core/*"
        ]
    }
  }
}

Currently the following code is not resolved in tsc, and only resolved in vs code.

import { Test } from "@Core/Test"

This outputs an error that @Core/Test module is not found

Expected behavior:
It should resolve to:

import { Test } from "../../Test"

Actual behavior:
It stays the same in the output file, and is not resolved.

import { Test } from "@Core/Test"

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions