You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// our server.js code:constexpress=require("express");constwebpack=require("webpack");constwebpackDevMiddleware=require("webpack-dev-middleware");constwebpackDevConfig=require("./webpack.dev.config.js");constwebpackCompiler=webpack(webpackDevConfig);constapp=express();app.use(webpackDevMiddleware(webpackCompiler,{┊stats: false,┊loglevel: "trace",┊lazy: false,┊publicPath: webpackDevConfig.output.publicPath,// when this is false, there isn't any problem┊writeToDisk: true,}));app.listen(8506,()=>console.log("Webpack server started on port 8506..."));
// Our webpack config is fairly large, but I'm not sure how useful it'll be here.// I have the majority of our non-project-specific code below.// there are a few configs that all share these options, with slightly different// entrypoints.constdevOptions={output: {┊path: path.join(ASSETS_ROOT,"dist","js","webpack"),┊publicPath: `https://our.dev.server/ac/webpack/js/`,┊filename: `${locale}/[name].js`,},mode: "development",devtool: "eval",cache: true,stats: false,watch: true,watchOptions: {┊ignored: ignoreList,},plugins: [┊newwebpack.NoEmitOnErrorsPlugin(),┊newwebpack.ProgressPlugin({profile: false}),],optimization: {┊removeAvailableModules: false,┊removeEmptyChunks: false,┊splitChunks: false,},};
Expected Behavior
webpack-dev-middleware initializes without errors when writeToDisk is enabled
Actual Behavior
webpack-dev-middleware throws this exception when writeToDisk is set to true, but runs fine otherwise:
/home/shilal/development/builda-webpack/node_modules/webpack-dev-middleware/lib/fs.js:15
context.compiler.hooks.afterEmit.tap('WebpackDevMiddleware', (compilation) => {
^
TypeError: Cannot read property 'tap' of undefined
at toDisk (/path/to/project/node_modules/webpack-dev-middleware/lib/fs.js:15:38)
at wdm (/path/to/project/node_modules/webpack-dev-middleware/index.js:65:5)
at Object.<anonymous> (/path/to/project/server.js:12:5)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
This seems to be because the MultiCompiler that's created when an array of configs is used does not have an afterEmit hook to tap into.
Here's a screenshot of the hooks, and a console log of the compiler, just before the exception above is thrown.
For Bugs; How can we reproduce the behavior?
Turn on the writeToDisk flag and be sure to use an array of configs, rather than a single config.
The text was updated successfully, but these errors were encountered:
Code
Expected Behavior
webpack-dev-middleware initializes without errors when
writeToDisk
is enabledActual Behavior
webpack-dev-middleware throws this exception when
writeToDisk
is set totrue
, but runs fine otherwise:This seems to be because the
MultiCompiler
that's created when an array of configs is used does not have anafterEmit
hook to tap into.Here's a screenshot of the hooks, and a console log of the compiler, just before the exception above is thrown.
For Bugs; How can we reproduce the behavior?
Turn on the
writeToDisk
flag and be sure to use an array of configs, rather than a single config.The text was updated successfully, but these errors were encountered: