Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Commit 69a0a29

Browse files
Handle Webpack 2.1.0 beta 23 renaming 'loaders' to 'rules'. Fixes #460.
1 parent 8401bbf commit 69a0a29

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack-react/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aspnet-webpack-react",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "Helpers for using Webpack with React in ASP.NET Core projects. Works in conjunction with the Microsoft.AspNetCore.SpaServices NuGet package.",
55
"main": "index.js",
66
"scripts": {

src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack-react/src/HotModuleReplacement.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import * as webpack from 'webpack';
22

33
export function addReactHotModuleReplacementBabelTransform(webpackConfig: webpack.Configuration) {
4-
webpackConfig.module.loaders.forEach(loaderConfig => {
4+
const moduleRules: webpack.Loader[] =
5+
(webpackConfig.module as any).rules // Webpack < 2.1.0 beta 23
6+
|| webpackConfig.module.loaders; // Webpack >= 2.1.0 beta 23
7+
8+
moduleRules.forEach(loaderConfig => {
59
if (loaderConfig.loader && loaderConfig.loader.match(/\bbabel-loader\b/)) {
610
// Ensure the babel-loader options includes a 'query'
711
const query = loaderConfig.query = loaderConfig.query || {};

0 commit comments

Comments
 (0)