Skip to content

[DEP_WEBPACK_WATCH_WITHOUT_CALLBACK] error when using --watch flag #1918

@sanex3339

Description

@sanex3339

Describe the bug

PR with the configuration
javascript-obfuscator/javascript-obfuscator#776

After upgrade from webpack@4 to webpack@5 and webpack-cli@3 to [email protected] I got the following error:

[DEP_WEBPACK_WATCH_WITHOUT_CALLBACK] DeprecationWarning: A 'callback' argument need 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.

This error happens only when using --watch flag:

webpack --config ./webpack/webpack.node.config.js --mode development --watch

Full error trace:

(node:62890) [DEP_WEBPACK_WATCH_WITHOUT_CALLBACK] DeprecationWarning: A 'callback' argument need 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.
    at webpack (/Users/sanex/WebstormProjects/javascript-obfuscator/node_modules/webpack/lib/webpack.js:145:5)
    at f (/Users/sanex/WebstormProjects/javascript-obfuscator/node_modules/webpack/lib/index.js:35:15)
    at Compiler.createCompiler (/Users/sanex/WebstormProjects/javascript-obfuscator/node_modules/webpack-cli/lib/utils/Compiler.js:129:35)
    at WebpackCLI.run (/Users/sanex/WebstormProjects/javascript-obfuscator/node_modules/webpack-cli/lib/webpack-cli.js:220:32)
    at async runCLI (/Users/sanex/WebstormProjects/javascript-obfuscator/node_modules/webpack-cli/lib/bootstrap.js:74:24)

Expected behavior

No error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions