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

Commit 4696632

Browse files
In LoadViaWebpack, account for CSS/font/etc files referenced with URLs that have a querystring. Fixes #335.
1 parent adf4732 commit 4696632

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aspnet-webpack",
3-
"version": "1.0.15",
3+
"version": "1.0.16",
44
"description": "Helpers for using Webpack 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/src/LoadViaWebpack.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,16 @@ function loadViaWebpackNoCache<T>(webpackConfigPath: string, modulePath: string)
7777
// load that via Webpack rather than as a regular CommonJS module.
7878
//
7979
// So, configure webpack-externals-plugin to 'whitelist' (i.e., not treat as external) any file
80-
// that has an extension other than .js.
80+
// that has an extension other than .js. Also, since some libraries such as font-awesome refer to
81+
// their own files with cache-busting querystrings (e.g., (url('./something.css?v=4.1.2'))), we
82+
// need to treat '?' as an alternative 'end of filename' marker.
8183
//
82-
// This regex looks for at least one dot character that is *not* followed by "js<end>", but
83-
// is followed by some series of non-dot characters followed by <end>:
84-
whitelist: [/\.(?!js$)([^.]+$)/]
84+
// The complex, awkward regex can be eliminated once webpack-externals-plugin merges
85+
// https://github.com/liady/webpack-node-externals/pull/12
86+
//
87+
// This regex looks for at least one dot character that is *not* followed by "js<end-or-questionmark>", but
88+
// is followed by some series of non-dot characters followed by <end-or-questionmark>:
89+
whitelist: [/\.(?!js(\?|$))([^.]+(\?|$))/]
8590
}));
8691

8792
// The CommonsChunkPlugin is not compatible with a CommonJS environment like Node, nor is it needed in that case

0 commit comments

Comments
 (0)