-
Notifications
You must be signed in to change notification settings - Fork 74
Support for TypeScript 2.0 Module resolution #160
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
Comments
I am currently trying to find and fix whatever it is with the TypeScript 2.0.0 beta that breaks my tsify-based builds. Once I've done that, I can have a look to see what the JS output looks like when the new module resolution options are used, as that's all Browserify will care about. |
Indeed I think this might be out of scope for Architecture notes:We register ourselves a plugin. On load we resolve to some tsconfig.json and create a typescript |
@cartant The output of TS 2.0 stays exactly the same as if those options weren't there. Those new options from tsconfig.json are really only ever evaluated by the TS compiler itself for TS-related but they do not affect the compiled output. That's the problem here. @basarat Okay, that's a fair amount of really valuable information. ❤️ Yesterday I fiddled around a bit and was able to reproduce parts of this new specification outside of tsify. In case anything comes around and I'd be able to fully reproduce what the TypeScript 2.0 spec says I will post an update here. |
@loilo It's the paths that are written into the @basarat I'll submit a PR with some architectural notes - and some optimization strategies for avoiding repeated TypeScript compilations - when I'm done. I guess I'll add them to the CONTRIBUTING.md document. |
@cartant That's exactly what I meant - the paths you write into the TS But you will see that on your own when it comes to that. 👍 |
@loilo No worries. Thanks. |
Is there any progress on this topic? I would love a flexibility aliasify is giving you with If not, I am planning to write a tool which might replace aliasify. My goal is to create a tool which is able to dynamically replace certain aliases in string arguments of configurable function calls (e.g. require, import, proxyquire, etc.) by traversing the ast's of the code files. The tool should not be coupled strictly with .ts files, but rather should be also extendable for CoffeeScript files or else. EDIT: As I just read, it is not possible to modify the AST with the current public API (TS Issue #7580) |
@kamekazemaster There isn't going to be anything code-related done with this issue, as the module resolution is up to browserify. It'll be necessary to have some browserify configuration that performs the same resolution that TypeScript uses. I was planning - when I get the time - to have a look at this and include an example of such a configuration in the README. Last time I needed to do path-related stuff with browserfiy, I used pathmodify, so that would be the way I'd approach this issue - but I've not made it a priority. |
I won't get into whether or not it's |
As you certainly know one of the big improvements with TypeScript 2.0 is the ability for developers to define their own path mappings and determine the path(s) where there modules are located. (More information here: What's new in TypeScript, the detailed proposal on GitHub).
The whole thing is done via the introduction of
compilerOptions
entriesbaseUrl
,paths
, androotDirs
. TypeScript 2.0 recognizes and handles them correctly but sadly (or rather by design) those paths are not rewritten to relative ones so tsify can't handle them at the moment.It would be amazing to have those options taken into account for bundling. 👍
The text was updated successfully, but these errors were encountered: