Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aspnet-webpack

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aspnet-webpack - npm Package Compare versions

Comparing version 1.0.24 to 1.0.25

2

package.json
{
"name": "aspnet-webpack",
"version": "1.0.24",
"version": "1.0.25",
"description": "Helpers for using Webpack in ASP.NET Core projects. Works in conjunction with the Microsoft.AspNetCore.SpaServices NuGet package.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -22,2 +22,3 @@ import * as connect from 'connect';

suppliedOptions: DevServerOptions;
hotModuleReplacementEndpointUrl: string;
}

@@ -32,3 +33,3 @@

function attachWebpackDevMiddleware(app: any, webpackConfig: webpack.Configuration, enableHotModuleReplacement: boolean, enableReactHotModuleReplacement: boolean, hmrEndpoint: string) {
function attachWebpackDevMiddleware(app: any, webpackConfig: webpack.Configuration, enableHotModuleReplacement: boolean, enableReactHotModuleReplacement: boolean, hmrClientEndpoint: string, hmrServerEndpoint: string) {
// Build the final Webpack config based on supplied options

@@ -49,3 +50,3 @@ if (enableHotModuleReplacement) {

const webpackHotMiddlewareEntryPoint = 'webpack-hot-middleware/client';
const webpackHotMiddlewareOptions = `?path=` + encodeURIComponent(hmrEndpoint);
const webpackHotMiddlewareOptions = `?path=` + encodeURIComponent(hmrClientEndpoint);
if (typeof entryPoints[entryPointName] === 'string') {

@@ -123,3 +124,5 @@ entryPoints[entryPointName] = [webpackHotMiddlewareEntryPoint + webpackHotMiddlewareOptions, entryPoints[entryPointName]];

}
app.use(webpackHotMiddlewareModule(compiler));
app.use(webpackHotMiddlewareModule(compiler, {
path: hmrServerEndpoint
}));
}

@@ -205,4 +208,12 @@ }

const hmrEndpoint = `http://localhost:${listener.address().port}/__webpack_hmr`;
attachWebpackDevMiddleware(app, webpackConfig, enableHotModuleReplacement, enableReactHotModuleReplacement, hmrEndpoint);
// Newer versions of Microsoft.AspNetCore.SpaServices will explicitly pass an HMR endpoint URL
// (because it's relative to the app's URL space root, which the client doesn't otherwise know).
// For back-compatibility, fall back on connecting directly to the underlying HMR server (though
// that won't work if the app is hosted on HTTPS because of the mixed-content rule, and we can't
// run the HMR server itself on HTTPS because in general it has no valid cert).
const hmrClientEndpoint = options.hotModuleReplacementEndpointUrl // The URL that we'll proxy (e.g., /__asp_webpack_hmr)
|| `http://localhost:${listener.address().port}/__webpack_hmr`; // Fall back on absolute URL to bypass proxying
const hmrServerEndpoint = options.hotModuleReplacementEndpointUrl
|| '/__webpack_hmr'; // URL is relative to webpack dev server root
attachWebpackDevMiddleware(app, webpackConfig, enableHotModuleReplacement, enableReactHotModuleReplacement, hmrClientEndpoint, hmrServerEndpoint);
}

@@ -209,0 +220,0 @@ });

@@ -8,3 +8,3 @@ "use strict";

var RequireNewCopy_1 = require('./RequireNewCopy');
function attachWebpackDevMiddleware(app, webpackConfig, enableHotModuleReplacement, enableReactHotModuleReplacement, hmrEndpoint) {
function attachWebpackDevMiddleware(app, webpackConfig, enableHotModuleReplacement, enableReactHotModuleReplacement, hmrClientEndpoint, hmrServerEndpoint) {
// Build the final Webpack config based on supplied options

@@ -24,3 +24,3 @@ if (enableHotModuleReplacement) {

var webpackHotMiddlewareEntryPoint = 'webpack-hot-middleware/client';
var webpackHotMiddlewareOptions = "?path=" + encodeURIComponent(hmrEndpoint);
var webpackHotMiddlewareOptions = "?path=" + encodeURIComponent(hmrClientEndpoint);
if (typeof entryPoints_1[entryPointName] === 'string') {

@@ -91,3 +91,5 @@ entryPoints_1[entryPointName] = [webpackHotMiddlewareEntryPoint + webpackHotMiddlewareOptions, entryPoints_1[entryPointName]];

}
app.use(webpackHotMiddlewareModule(compiler));
app.use(webpackHotMiddlewareModule(compiler, {
path: hmrServerEndpoint
}));
}

@@ -167,4 +169,12 @@ }

normalizedPublicPaths_1.push(removeTrailingSlash(publicPath));
var hmrEndpoint = "http://localhost:" + listener.address().port + "/__webpack_hmr";
attachWebpackDevMiddleware(app, webpackConfig, enableHotModuleReplacement, enableReactHotModuleReplacement, hmrEndpoint);
// Newer versions of Microsoft.AspNetCore.SpaServices will explicitly pass an HMR endpoint URL
// (because it's relative to the app's URL space root, which the client doesn't otherwise know).
// For back-compatibility, fall back on connecting directly to the underlying HMR server (though
// that won't work if the app is hosted on HTTPS because of the mixed-content rule, and we can't
// run the HMR server itself on HTTPS because in general it has no valid cert).
var hmrClientEndpoint = options.hotModuleReplacementEndpointUrl // The URL that we'll proxy (e.g., /__asp_webpack_hmr)
|| "http://localhost:" + listener.address().port + "/__webpack_hmr"; // Fall back on absolute URL to bypass proxying
var hmrServerEndpoint = options.hotModuleReplacementEndpointUrl
|| '/__webpack_hmr'; // URL is relative to webpack dev server root
attachWebpackDevMiddleware(app, webpackConfig, enableHotModuleReplacement, enableReactHotModuleReplacement, hmrClientEndpoint, hmrServerEndpoint);
}

@@ -171,0 +181,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc