Deleting references to 'react-hot-loader/webpack' and 'react-hot-loader/patch' as it was removed in v4 of react-hot-loader. Bumping peer dependency of webpack to 3 and 4

This commit is contained in:
Tomasz Jaskula
2018-06-07 21:43:32 +02:00
committed by Steve Sanderson
parent 78a8bbf783
commit 59ca023f46
2 changed files with 4 additions and 17 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "aspnet-webpack-react", "name": "aspnet-webpack-react",
"version": "3.0.0", "version": "4.0.0",
"description": "Helpers for using Webpack with React in ASP.NET Core projects. Works in conjunction with the Microsoft.AspNetCore.SpaServices NuGet package.", "description": "Helpers for using Webpack with React in ASP.NET Core projects. Works in conjunction with the Microsoft.AspNetCore.SpaServices NuGet package.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@@ -17,12 +17,12 @@
"url": "https://github.com/aspnet/JavaScriptServices.git" "url": "https://github.com/aspnet/JavaScriptServices.git"
}, },
"devDependencies": { "devDependencies": {
"@types/webpack": "^2.2.0", "@types/webpack": "^4.4.0",
"rimraf": "^2.5.4", "rimraf": "^2.5.4",
"typescript": "^2.0.0", "typescript": "^2.0.0",
"webpack": "^2.2.0" "webpack": "^4.16.0"
}, },
"peerDependencies": { "peerDependencies": {
"webpack": "^2.2.0" "webpack": "^4.0.0"
} }
} }

View File

@@ -1,7 +1,5 @@
import * as webpack from 'webpack'; import * as webpack from 'webpack';
const reactHotLoaderWebpackLoader = 'react-hot-loader/webpack';
const reactHotLoaderPatch = 'react-hot-loader/patch';
const supportedTypeScriptLoaders = ['ts-loader', 'awesome-typescript-loader']; const supportedTypeScriptLoaders = ['ts-loader', 'awesome-typescript-loader'];
export function addReactHotModuleReplacementConfig(webpackConfig: webpack.Configuration) { export function addReactHotModuleReplacementConfig(webpackConfig: webpack.Configuration) {
@@ -27,12 +25,6 @@ export function addReactHotModuleReplacementConfig(webpackConfig: webpack.Config
continue; continue;
} }
// This is the one - prefix it with the react-hot-loader loader
// (unless it's already in there somewhere)
if (!containsLoader(loadersArray, reactHotLoaderWebpackLoader)) {
loadersArray.unshift(reactHotLoaderWebpackLoader);
rule.use = loadersArray; // In case we normalised it to an array
}
break; break;
} }
@@ -48,11 +40,6 @@ export function addReactHotModuleReplacementConfig(webpackConfig: webpack.Config
// Normalise to array // Normalise to array
entryConfig[entrypointName] = [entryConfig[entrypointName] as string]; entryConfig[entrypointName] = [entryConfig[entrypointName] as string];
} }
let entryValueArray = entryConfig[entrypointName] as string[];
if (entryValueArray.indexOf(reactHotLoaderPatch) < 0) {
entryValueArray.unshift(reactHotLoaderPatch);
}
}); });
} }