jakoblind / webpack-autoconf

A tool to create frontend apps using webpack, Parcel or Snowpack
https://createapp.dev/
876 stars 78 forks source link

Change Webpack TypeScript loader #81

Closed wapcrazut closed 4 years ago

wapcrazut commented 4 years ago

A simple change for using the recommended ts-loader instead the awesome-typescript-loader.

See how Webpack's TypeScript documentation indicates to use ts-loader too.

Also see https://www.npmtrends.com/awesome-typescript-loader-vs-ts-loader for latest usage trends.

No major changes needed (I think).

Related to #79

jakoblind commented 4 years ago

@theajr do you remember why we moved from ts-loader to awesome-typescript-loader? It was done in this commit https://github.com/jakoblind/webpack-autoconf/pull/51/commits/48fd35d78ef8789c25b6e1057ad1cbebb8b31651

theajr commented 4 years ago

@jakoblind I don't exactly remember but it has to do with Hot Module Replacement. As per their documentation, it seems they don't fully support or something is missing. Maybe that's why I switched to awesome-typescript-loader. Just we have to make sure the HMR support is working with react and normal web pack projects.

jakoblind commented 4 years ago

I just tested React+ts-loader and HMR, and it works. But the docs say they don't support it so.. I see three options

  1. Just do it like this. if it works it works.
  2. Use ts-loader when react hot loader is not selected and awesome-typescript-loader when it IS selected.
  3. Implement the workarounds described in the docs.

I'm leaning against 1 or 2. what do you guys think?

wapcrazut commented 4 years ago
2. Use `ts-loader` when react hot loader is not selected and `awesome-typescript-loader` when it IS selected.

@jakoblind I personally like this option for ensuring backwards compatibility but in the UI should describe the available options briefly explain (with the question mark button or similar) why this switch is begin made.

jakoblind commented 4 years ago

I agree @wapcrazut. This seems like the correct solution. Do you want to implement it?

wapcrazut commented 4 years ago

Sure, I'll try to do some progress on my free time.

jakoblind commented 4 years ago

I'm merging this, and we can fix hot loading in separate PR