webpack-dashboard: Non-watch Webpack instances hang when dashboard is running

My workflow has a watch, and then a non-watch webpack process. The non-watch one runs any time I push or pull from git. When i have the watch process running, with the dashboard, the non-watch process hangs until i kill it or the dashboard.

Steps to reproduce the problem

Run any webpack profile, without the --watch flag, and with the plugin included, and it will hang after its finished, with or without webpack-dashboard actually running.

Please provide a gist of relevant files

webpack -d --progress --colors --config webpack.config.js Webpack Config File https://gist.github.com/aequasi/7cc2378fc965c013ade0b4a1a4f6a8a5

More Details
  • Any OS
  • ITerm2/Terminal/PHPStorm
  • 0.1.1
  • xterm-256color

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 17 (6 by maintainers)

Commits related to this issue

Most upvoted comments

This is because you both are including the dashboard plugin in production. Putting a flag around it so it only gets added in dev, or splitting your config files into dev and prod should fix it.

Yes, but is there a reason for plugin to “hang” the process?

This makes it somewhat more difficult to keep configurations intact - you cannot call webpack with webpack-dashboard if plugin is not enabled and if you do enable it, it will hang the process even if it’s called without webpack-dashboard.

Could it maybe look at the child process? As webpack exits after job is done and webpack-dev-server does not - just like webpack-dashboard should when running one or another.

Furthermore, you cannot run webpack in development environment this way .

I’ve proposed a fix for this in #215. In the meantime, here is a workaround:

// webpack.config.js
const DashboardPlugin = require('webpack-dashboard/plugin');

const devConfig = {
  // rest of config as usual...
  plugins: [
    {
      apply: function() {
        const dashboard = new DashboardPlugin({color: 'cyan'});
        dashboard.apply.apply(dashboard, arguments);
      }
    }
  ]
};

👍 Seems wrong to hang when invoking webpack without webpack-dashboard.

@fancyfootowork’s yargs solution worked for me.

I ran into the same error. I ended up adding yargs. Seems to do the trick. In webpack.config.js:

const argv = require('yargs').argv;

then after setting up the main config:

if (argv.watch) {
  const DashboardPlugin = require('webpack-dashboard/plugin');
  config = merge(config, { plugins: [new DashboardPlugin()] });
}

(to use merge just include that at the top of your webpack.config.js)

const merge = require('webpack-merge');