-
Notifications
You must be signed in to change notification settings - Fork 518
Webpack 4 support #1562
Comments
The error @lkt82 is experiencing is likely coming from their webpack.config. There are several webpack plugins that haven't updated to webpack 4's new APIs. However, this repo does need to do some work to enable webpack 4 support. A couple things I noticed from my own tests: webpack requires that you set a mode now for builds (either 'production' or 'development'). You can work around this by setting the mode in your actual config. I do this through the --env.prod flag that the templates here recommended. It seems that your HMR injection in aspnet-webpack isn't working properly with webpack 4. I haven't looked into this much but it might have something to do with how you are initializing the dev server? |
I am not using any plugins at all. { |
Its possible that ts-loader is causing your deprecation warning. However, it is also entirely possible that this repo's aspnet-webpack is causing it too. I am not sure. But at least for now, that deprecation warning should not be blocking anything. |
I've done a little more investigation into this: The aspnet-webpack package can work as-is with webpack 4 but you will get those deprecation warnings because the The deprecation warning will only show up once even if multiple places are using the old api meaning it takes a bit of time to find all the causes of it. I have identified two so far:
(compiler as any).plugin('done', stats => {
copyRecursiveToRealFsSync(compiler.outputFileSystem, '/', [/\.hot-update\.(js|json|js\.map)$/]);
}); should be (compiler as any).hooks.done('aspnet-webpack', stats => {
copyRecursiveToRealFsSync(compiler.outputFileSystem, '/', [/\.hot-update\.(js|json|js\.map)$/]);
}); however, this would likely be a breaking change so you might want to check for the presence of
|
On HMR, it seems to be working but for several versions now it has been kicking off a full rebuild on startup which is maddening. Also when it does HMR it is rebuilding all entrypoints not just the one that changed so all of my vendor and polyfills are getting rebuilt for no reason. Would love to be able to specify the entrypoint that it monitors for rebuilds. |
@SteveSandersonMS Is this something that is on your radar or something you'd accept a PR for? I was initially hesitant to make a PR for this because it'd likely be breaking and didn't want to mess with your support story. |
@JohnGalt1717 I was able to resolve the my HMR issue by switching from |
I get this after updating to Webpack 4. Is it from here: Line 3 in 48b923f
? |
According to my app logs below, it seems like the main issue is that the latest version of
|
We just published |
@SteveSandersonMS Is aspnet-webpack supposed to be compatible with webpack 4? I'm seeing the following npm warning below. I'm also running into problems, but that might be irrelevant if support for webpack 4 is still a work in progress.
|
@pbarranis you need to follow the instructions in the npm warning. webpack-dev-middleware is now a peer dependency so that aspnet-webpack stays backwards compatible with older webpack versions. If you are using webpack 4 then you'll need to add the latest webpack-dev-middleware to your project's dev-dependencies as well. |
Description
Hi:) I'm getting an error when I try to use webpack 4 in combination with UseWebpackDevMiddleware
Error Message
fail: Microsoft.AspNetCore.NodeServices[0]
(node:19264) DeprecationWarning: Tapable.plugin is deprecated. Use new API on
.hooks
insteadIs this something you can fix :)?
The text was updated successfully, but these errors were encountered: