mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 01:58:29 +00:00
Handle Webpack 2.1.0 beta 23 renaming 'loaders' to 'rules'. Fixes #460.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "aspnet-webpack-react",
|
"name": "aspnet-webpack-react",
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"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": {
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import * as webpack from 'webpack';
|
import * as webpack from 'webpack';
|
||||||
|
|
||||||
export function addReactHotModuleReplacementBabelTransform(webpackConfig: webpack.Configuration) {
|
export function addReactHotModuleReplacementBabelTransform(webpackConfig: webpack.Configuration) {
|
||||||
webpackConfig.module.loaders.forEach(loaderConfig => {
|
const moduleRules: webpack.Loader[] =
|
||||||
|
(webpackConfig.module as any).rules // Webpack < 2.1.0 beta 23
|
||||||
|
|| webpackConfig.module.loaders; // Webpack >= 2.1.0 beta 23
|
||||||
|
|
||||||
|
moduleRules.forEach(loaderConfig => {
|
||||||
if (loaderConfig.loader && loaderConfig.loader.match(/\bbabel-loader\b/)) {
|
if (loaderConfig.loader && loaderConfig.loader.match(/\bbabel-loader\b/)) {
|
||||||
// Ensure the babel-loader options includes a 'query'
|
// Ensure the babel-loader options includes a 'query'
|
||||||
const query = loaderConfig.query = loaderConfig.query || {};
|
const query = loaderConfig.query = loaderConfig.query || {};
|
||||||
|
|||||||
Reference in New Issue
Block a user