Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callback in being ignored in the multicompication case #247

Open
TokugawaTakeshi opened this issue Nov 29, 2022 · 0 comments
Open

Callback in being ignored in the multicompication case #247

TokugawaTakeshi opened this issue Nov 29, 2022 · 0 comments

Comments

@TokugawaTakeshi
Copy link

TokugawaTakeshi commented Nov 29, 2022

The running of gulp build corresponding to below setup

const gulp = require("gulp");
const gulpWebpack = require('webpack-stream');


const webpackConfig = {
  watch: true,
  mode: "production"
};


gulp.task("webpack", function() {
  return gulp.src("Source/EntryPoint.js").
      pipe(
        gulpWebpack(
          { config: webpackConfig },
          null,
          (error, statistics) => {

            if (error) {
              console.error(error);
            }

            if (statistics) {
              process.stdout.write(`${ statistics.toString({ colors: true }) }\n`);
            }

          }
        )
      ).
      pipe(gulp.dest("Output/"));
});


gulp.task("build", gulp.series("webpack"));

causes the following warning:

(node:41540) [DEP_WEBPACK_WATCH_WITHOUT_CALLBACK] DeprecationWarning: A 'callback' argument needs to be provided to the 'webpack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.

and the execution stops after first build. If we'll replace the multicompilation with single compilation:

const gulp = require("gulp");
const gulpWebpack = require('webpack-stream');

gulp.task("webpack", function() {
  return gulp.src("Source/EntryPoint.js").
      pipe(
        gulpWebpack(
           {
              watch: true,
              mode: "production"
           },
          null,
          (error, statistics) => {

            if (error) {
              console.error(error);
            }

            if (statistics) {
              process.stdout.write(`${ statistics.toString({ colors: true }) }\n`);
            }

          }
        )
      ).
      pipe(gulp.dest("Output/"));
});

everything will work fine.

If it is the bug, would you please to fix it?
I have pasted the reproduction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant