In LoadViaWebpack, account for CSS/font/etc files referenced with URLs that have a querystring. Fixes #335.

This commit is contained in:
SteveSandersonMS
2016-09-28 09:57:46 +01:00
parent adf4732191
commit 46966322b7
2 changed files with 10 additions and 5 deletions

View File

@@ -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": {

View File

@@ -77,11 +77,16 @@ function loadViaWebpackNoCache<T>(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<end>", but
// is followed by some series of non-dot characters followed by <end>:
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<end-or-questionmark>", but
// is followed by some series of non-dot characters followed by <end-or-questionmark>:
whitelist: [/\.(?!js(\?|$))([^.]+(\?|$))/]
}));
// The CommonsChunkPlugin is not compatible with a CommonJS environment like Node, nor is it needed in that case