Skip to content
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

Matching an alias to another inappropriate import path #45

Closed
justkey007 opened this issue Jul 2, 2021 · 0 comments
Closed

Matching an alias to another inappropriate import path #45

justkey007 opened this issue Jul 2, 2021 · 0 comments

Comments

@justkey007
Copy link
Owner

Following pull request #44

I have a typescript config as follows:

{
  "compilerOptions": {
    "outDir": "./dist",
    "baseUrl": "./",
    "paths": {
      "@*": ["./src/*"],
      "@router": ["./src/controllers/index.ts"]
    }
  }
}

And I do an import like this:
Important: the router folder does not exist

import { Controller } from '@controllers/index';
import { Router } from '@router';

new Controller();

new Router();

Expected Result

After using tsc-alias, the result should be the following:

"use strict";
exports.__esModule = true;
var index_1 = require("./controllers/index");
var _router_1 = require("./controllers/index.js");
new index_1.Controller();
new _router_1.Router();

Current Result

"use strict";
exports.__esModule = true;
var index_1 = require("./controllers/index");
var _router_1 = require("./router");
new index_1.Controller();
new _router_1.Router();

Proposed solution

Sort aliases in descending order according to their length

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant