-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Q: Remapping import path for browsers #19942
Comments
This is not a support forum. Questions should be asked at StackOverflow or on Gitter.im. But, TypeScript does not re-write module paths, it only provides the tools to be able to resolve different paths under different loaders. |
Then how about a suggestion to have this sort of behaviour. I want to be able to use browser native importing (with typescript being able to find the correct typings file for it) rather than a 3rd party loader. |
Like @kitsonk said, TypeScript will not change your code, so the path you import from in the That said, I don't think we have a good mechanism for allowing you to match up relative |
The native browser loader will not load CommonJS modules anyways (standard Node.js module format), so I don't think you are missing relative The issues of dealing with some level of compatibility with native loaders is covered under #13422. |
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
TypeScript Version: 2.6.1
I am using a library called "gl-matrix" which I have the code and typings installed via npm.
npm install gl-matrix
npm install @types/gl-matrix
And it works fine in typescript with intellisense and all
root/src/index.js
but the thing is, since browsers are now starting to natively support import statements, instead having to use require.js or something, I wanna do this natively, but I can't figure out how to get it to convert to the real import path of the javascript code for gl-matrix.
When it compiles I'd like it to point to root/node_modules/gl-matrix/dist/gl-matrix-min.js so I want it to emit this
I thought I could achieve this with the paths property of tsconfig, but apparently not.
tsconfig.json
So my question is: is it possible to remap the import path when compiling to javascript, and if so how to do it.
My directory structure is:
root
The text was updated successfully, but these errors were encountered: