From 46966322b7509f4ae01ec11870707ee2153267cf Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Wed, 28 Sep 2016 09:57:46 +0100 Subject: [PATCH] In LoadViaWebpack, account for CSS/font/etc files referenced with URLs that have a querystring. Fixes #335. --- .../npm/aspnet-webpack/package.json | 2 +- .../npm/aspnet-webpack/src/LoadViaWebpack.ts | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json b/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json index 6f47252..4b0d282 100644 --- a/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json +++ b/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json @@ -1,6 +1,6 @@ { "name": "aspnet-webpack", - "version": "1.0.15", + "version": "1.0.16", "description": "Helpers for using Webpack in ASP.NET Core projects. Works in conjunction with the Microsoft.AspNetCore.SpaServices NuGet package.", "main": "index.js", "scripts": { diff --git a/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/LoadViaWebpack.ts b/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/LoadViaWebpack.ts index 9097a55..faee069 100644 --- a/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/LoadViaWebpack.ts +++ b/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/LoadViaWebpack.ts @@ -77,11 +77,16 @@ function loadViaWebpackNoCache(webpackConfigPath: string, modulePath: string) // load that via Webpack rather than as a regular CommonJS module. // // So, configure webpack-externals-plugin to 'whitelist' (i.e., not treat as external) any file - // that has an extension other than .js. + // that has an extension other than .js. Also, since some libraries such as font-awesome refer to + // their own files with cache-busting querystrings (e.g., (url('./something.css?v=4.1.2'))), we + // need to treat '?' as an alternative 'end of filename' marker. // - // This regex looks for at least one dot character that is *not* followed by "js", but - // is followed by some series of non-dot characters followed by : - whitelist: [/\.(?!js$)([^.]+$)/] + // The complex, awkward regex can be eliminated once webpack-externals-plugin merges + // https://github.com/liady/webpack-node-externals/pull/12 + // + // This regex looks for at least one dot character that is *not* followed by "js", but + // is followed by some series of non-dot characters followed by : + whitelist: [/\.(?!js(\?|$))([^.]+(\?|$))/] })); // The CommonsChunkPlugin is not compatible with a CommonJS environment like Node, nor is it needed in that case