Hot Module Reloading using typescript only (without babel) doesn't work #1198

Closed
opened 2025-08-09 17:19:14 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @Maarten88 on 12/8/2016

I read about the new typescript 2.1 release and figured it should be possible to remove babel from my ReactReduxSpa-derived webpack config, which I tried.
It works, but it broke HMR. This seems to be caused by the aspnet-webpack-react module checking explicitly for babel-loader in HotModuleReplacement:

if (loaderConfig.loader && (loaderConfig.loader.match(/\bbabel-loader\b/))

If I change this line to:

if (loaderConfig.loader && (loaderConfig.loader.match(/\bbabel-loader\b/) || loaderConfig.loader.match(/\bawesome-typescript-loader\b/))) {

HMR starts working again. I added a check for awesome-typescript-loader which I use, the original uses ts-loader. My change might break the original config. Not sure how to do this correctly.

*Originally created by @Maarten88 on 12/8/2016* I read about the new typescript 2.1 release and figured it should be possible to remove babel from my ReactReduxSpa-derived webpack config, which I tried. It works, but it broke HMR. This seems to be caused by the aspnet-webpack-react module checking explicitly for babel-loader in HotModuleReplacement: if (loaderConfig.loader && (loaderConfig.loader.match(/\bbabel-loader\b/)) If I change this line to: if (loaderConfig.loader && (loaderConfig.loader.match(/\bbabel-loader\b/) || loaderConfig.loader.match(/\bawesome-typescript-loader\b/))) { HMR starts working again. I added a check for awesome-typescript-loader which I use, the original uses ts-loader. My change might break the original config. Not sure how to do this correctly.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1198
No description provided.