Add webpack 4 support to aspnet-webpack #104

Closed
opened 2025-08-09 17:15:01 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @mattvperry on 4/10/2018

This PR makes aspnet-webpack compatible with webpack 4. I did my best to keep the package backwards compatible. This PR does the following:

  1. Move webpack-dev-middleware to peerdependencies.
    • Webpack 4 requires a higher version of webpack-dev-middleware but as far as I can tell, that newer version won't work with Webpack < 4 so in order to maintain backwards compat we need package consumers to choose their version.
  2. Use the new hooks API for plugging into webpack
    • I added a check before deciding which API to use for hooking. This should maintain back compat.
  3. Some other housekeeping
    • Bumped the dev dependency version of webpack and @types/webpack to 4.5.0 so that aspnet-webpack stays current
    • Change the loadViaWebpack method to remove the ChunksPlugin only if the ChunksPlugin exists. It was removed in webpack 4
    • Change the output encoding of the node services's sub process. The newer version of webpack-dev-middleware was ouputing some unicode characters that weren't displaying correctly. I don't think this will affect anything else but I can take this out if it is a problem.

I did not bump the version of the package because I wasn't sure how you guys wanted to handle that. Support for webpack 4 is crucial for my team since this is the only remaining package causing us to hold off on the upgrade. I would greatly appreciate someone taking a look at this.

*Originally created by @mattvperry on 4/10/2018* This PR makes aspnet-webpack compatible with webpack 4. I did my best to keep the package backwards compatible. This PR does the following: 1. Move webpack-dev-middleware to peerdependencies. - Webpack 4 requires a higher version of webpack-dev-middleware but as far as I can tell, that newer version won't work with Webpack < 4 so in order to maintain backwards compat we need package consumers to choose their version. 2. Use the new hooks API for plugging into webpack - I added a check before deciding which API to use for hooking. This should maintain back compat. 3. Some other housekeeping - Bumped the dev dependency version of webpack and @types/webpack to 4.5.0 so that aspnet-webpack stays current - Change the loadViaWebpack method to remove the ChunksPlugin only if the ChunksPlugin exists. It was removed in webpack 4 - Change the output encoding of the node services's sub process. The newer version of webpack-dev-middleware was ouputing some unicode characters that weren't displaying correctly. I don't think this will affect anything else but I can take this out if it is a problem. I did not bump the version of the package because I wasn't sure how you guys wanted to handle that. Support for webpack 4 is crucial for my team since this is the only remaining package causing us to hold off on the upgrade. I would greatly appreciate someone taking a look at this.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#104
No description provided.