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

Module path mapping is not working in generated js files #16640

Closed
lovedota opened this issue Jun 20, 2017 · 4 comments
Closed

Module path mapping is not working in generated js files #16640

lovedota opened this issue Jun 20, 2017 · 4 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@lovedota
Copy link

TypeScript Version: 2.4.0

Code

  • I have a config
"paths": {
      "pages/*": ["./app/pages/*", "../../pages/*"],
      "helpers/*": ["./app/helpers/*", "../../helpers/*"]
}

Expected behavior:

var element_helpers_1 = require("../../helpers/element-helpers");
var manage_documents_page_1 = require("../../pages/manage-documents-page");

Actual behavior:

var element_helpers_1 = require("helpers/element-helpers");
var manage_documents_page_1 = require("pages/manage-documents-page");
@kitsonk
Copy link
Contributor

kitsonk commented Jun 20, 2017

path does not change the emit... it simply allows TypeScript to resolve dependencies at design time that would otherwise not be automatically resolved. Whatever run-time module loader you are using would need to support any run-time configuration you need to reflect your desired run-time configuration.

@DanielRosenwasser DanielRosenwasser added the Working as Intended The behavior described is the intended behavior; this is not a bug label Jun 20, 2017
@lovedota
Copy link
Author

@kitsonk but actually I don't use webpack so that i cannot use alias for mapping, can we automatically generate the correct path from mapping table ?

@kitsonk
Copy link
Contributor

kitsonk commented Jun 21, 2017

Simple answer is no. TypeScript does not re-write module names. You will need to move the modules via external tooling or use a loader that allows mapping (e.g. like RequireJS or SystemJS).

@mhegazy
Copy link
Contributor

mhegazy commented Aug 17, 2017

Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

4 participants