joonhocho/tscpaths

Webpack Integration

inakiarroyo opened this issue ยท 5 comments

Is there any change to integrate it with ts-loader or awesome-typescript-loader ?

You can use webpack's aliases https://webpack.js.org/configuration/resolve/ instead

@naffiq It won't really help him because typescript will still generate *.d.ts files with the wrong paths.

@iarroyo5 I craated a webpack-loader that does what this repository does but during webpack-build: https://github.com/stavalfi/babel-plugin-module-resolver-loader

@stavalfi thanks for creating the plugin and sharing it here, but I drop the use of absolute paths with Webpack and TS. Everything works much better, painless with relative paths.

@iarroyo5 haha.. I was close to it. but if you don't want to use my loader or any other tool to generate d.ts files, there is still a chance.

if you don't produce a typescript library, you don't have to. everything will work if you generate a website (index.html) so there is no need to create the .d.ts files in the first place because noone will use them. in this case, you can even drop the ts-loader from your build and only use https://github.com/TypeStrong/fork-ts-checker-webpack-plugin (which I hope you use anyways in any kind of build with typescript).

Totally agreed with you, but in my case I was using them for producing typescript libraries. By the way, many thanks for sharing the https://github.com/TypeStrong/fork-ts-checker-webpack-plugin, I'll give a try on my current/future builds ๐Ÿ‘ as a performance improvement.