-
Notifications
You must be signed in to change notification settings - Fork 74
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
Browserify's paths option does not seem to work with tsify #91
Comments
Just a quick 2 cents on this since something similar is implemented in ts-loader. You can implement |
I'm new to browserify (coming from requireJS), so I don't really know how easy it would be either. But thanks for the input. |
@jbrantly That's cool. I'm assuming that any code that you write using the Webpack resolve logic will look broken to Intellisense, though? Since I don't know how your tooling could know about the resolve logic being swapped out. This will take some work (especially going down the rabbit hole of Browserify's resolve logic) but it should be doable. |
Yup. That's the major downside 😦 BUT I'm hoping when microsoft/TypeScript#5039 gets implemented things will get a little better on the IDE front because you can duplicate some of your custom path mapping between what webpack/browserify understands and what TS understands. The previous sentence is worded awfully but hopefully you get my point. |
Dang, that is a crazy complicated proposal. What's giving me pause for implementing this (along with other similar features) is that for every "this feature is in Browserify, why doesn't it work with tsify" type issue, I can imagine an equally compelling "this feature is in tsify, why doesn't it work with my tooling" issue. And that's not something that tsify can fix. I dunno, I guess it's just that to me it feels more "TypeScripty" to use its module resolution semantics instead of Browserify's. Especially considering that Browserify actually supports swapping out the module resolution logic entirely (it uses It seems to me that a better end state would be a zero-configuration setup in which Browserify used TypeScript's module resolution directly (this could be implemented pretty simply)... At that point, assuming that the linked proposal is implemented, then you would have all of the benefits of configuring your paths in tsconfig, and none of the drawbacks of having to maintain your path configuration in two different places and formats. |
Very interesting. I'll have to keep that in mind as well. You make some good points. |
FYI microsoft/TypeScript#5039 was merged into the 2.0 branch earlier this year. Is anyone using I also like the "use TypeScript module resolution" option. If you consider tsify part of the TypeScript tooling it would make sense that you configure TypeScript once and all of the tooling automatically follows that. However, it may be hard to conceive how some users may be modifying their browserify config already. |
@aciccarello I've tried using the TS 2.0 module resolution (baseUrl in tsconfig.json). It works great when using the standalone compiler, but tsify doesn't seem to support the new TS branch yet (I mentioned the error in issue #149). |
I've come up with a temporary solution for gulp: https://gist.github.com/azarus/f369ee2ab0283ba0793b0ccf0e9ec590 Browserify & Gulp samples included. |
so |
@SteffenAnders Browserify's |
@cartant thanks for your response. i have fixed this by using tsconfig.json
gulpfile.js
|
Any progress on this? I've had to write my own script that transforms my tsconfig paths for use with aliasify. May be useful to others: https://gist.github.com/JakeSidSmith/6664afbc933e4c07e5c679658be671bf |
I spent an entire day tracking this issue down. Inside the https://github.com/TypeStrong/tsify#does-this-work-with section there's needs to be a blurb about |
any update here!!! |
@SteffenAnders thank you, I was able to use your code as a plugin to get this to work. |
Browserify have an option to specify which paths to look through when a file is "required" (
browserify({paths: ["./source/App"]})
), but that doesn't seem to work with tsify.It is very helpful when you want to avoid relative paths hell, as you can setup the base of your app as one of the starting points.
The alternative of putting your code in the node_modules folder seems both odd (considering the normal seperation of app code and dependencies) and requires you to commit node_modules to your repository.
And symlinks doesn't work on windows.
The text was updated successfully, but these errors were encountered: