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
{{ message }}
Repository navigation
[DEP_WEBPACK_WATCH_WITHOUT_CALLBACK] error when using --watch flag #1918
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)
I get the same error, but I think it's worth mentioning that the watch mode does actually work. Yes, it throws that warning at the start, but it still bundles and still watches for changes correctly.
Reacted by Tony Brix, 林鹏, Anthony Schwartzman, Jorge Fuentes, undeƒined, Dmitry Starosta, Yohan Dunon, bbb324, Max, Daveed Silva and 2 more
Reacted by Timofey Kachalov, Samuel Diaz Bidot, Yuta NAKAMIZO, Decade Hew, kawabata, Tomasz Karczmarczyk, Arthur Beaulieu, Tosh Meston, 林鹏, guiferviz and 14 more
@snitin315 No, will be fixed in the near future, the next PR
Reacted by Nitin Kumar, Kurt Furbush, Samuel Diaz Bidot, Esau Silva, Yury Tyshkevich, Yuta NAKAMIZO, t-fritsch, Auston Pramodh Barboza, Tosh Meston, 林鹏 and 5 more
Some problems on webpack side with new API, we are working on it, so I will do release with other fixes, but it will be fixed tomorrow with patch release
Reacted by Vitaliy Vasylyk, Lucas Mesquita Diniz, Martijn Schrage, stickykeys, Nicolas Derambure, masaru miyaudi, Alex Coaper, YAGITA Yugo, Alexandre Bourdeaud'hui and Yohan Dunon
I hit this with the latest versions of everything and I don't have watch: true set, so I don't think this config option being duplicated is the whole story.
√ Webpack
Compiled successfully in 1.55s
[webpack-cli] Compilationdevelopment starting...
(node:10048) [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.
(Use `node --trace-deprecation ...` to show where the warning was created)
Reacted by Ansel Santosa, Marko Antolić and Nick Chevsky
I did update to "webpack": "^5.3.2" and the error still appears
[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.
Reacted by Undermuz, Takahashi Kenta, Kay Gosho, Justin Force, Majin Bru, Dan Jacob, Victor Hiairrassary, Mika, Will Yu, Sergey Smirnov and 2 more
I think we're still waiting on a new release ( > 4.1.0 ) for this. If I test against the master branch it seems to work fine.
(You can use the master branch with yarn add --dev https://gitpkg.now.sh/webpack/webpack-cli/packages/webpack-cli)
EDIT: which is weird because allegedly 4.1.0 was the one that fixed watch mode. I'm still trying to narrow down exactly what fixed it... The deprecation warning was fixed in 2cb0c0e
Reacted by Xavier Fournet, Andrey Samborskiy, Cerino Ligutom III, Guillaume Humbert, SunShinewyf and Andrew Faulkner
Reacted by Jonathan del Strother, Pierre DARRIEUTORT, Matteo Bertoldo, geregaigor, Dmitry Shvedov, Cerino Ligutom III, kawabata, Danyel Fisher, Andrey Samborskiy and Andrew Faulkner
Reacted by Fran Casas, Gaetano Vallarelli, Andrey Samborskiy and Andrew Faulkner
Fixed in [email protected], if somebody faced with the problem again, please open a new issue with reproducible test repo, because we tests most of cases 😄
Reacted by Jake Bailey, Artyom, Danyel Fisher, Andrey Samborskiy, Chad, Ankur K, Guillaume Humbert, Lazar Mitic, Victor Hiairrassary, Yohan Dunon and 2 more
Reacted by silverwind, Tony Brix, Danyel Fisher, Kuzrys, Andrey Samborskiy, jamilabreu, Manuel Nucci, Edoardo Gargano, Jason Kirshner, Lazar Mitic and 5 more
Fixed in [email protected], if somebody faced with the problem again, please open a new issue with reproducible test repo, because we tests most of cases 😄
I did see a "DEP_WEBPACK_COMPILATION_ASSETS" but this comes from html-webpack-plugin
node v14.15.1
npm 6.14.8
Windows 10 x64
Thank you very much for your reply, but after removing html-webpack-plugin, I still have the same problem. I updated the github address after removing redundant packages
i'm not actually using pure webpack but webpack encore which uses webpack-cli 4, i see that 4.5 is the latest version but i guess i'll have to wait for webpack encore to upgrade it
Activity
alexander-akait commentedon Oct 11, 2020
@webpack/cli-team high priority
photonstorm commentedon Oct 12, 2020
I get the same error, but I think it's worth mentioning that the watch mode does actually work. Yes, it throws that warning at the start, but it still bundles and still watches for changes correctly.
raduchiriac commentedon Oct 12, 2020
Indeed, webpack v5 does not watch anymore if I remove
--watchand dowebpack --config webpack.config.jsI use this config:
Solution: With my config above the only way to go is adding
--watchwhich I'd prefer not tosnitin315 commentedon Oct 12, 2020
I will fix it 👍
alexander-akait commentedon Oct 12, 2020
We have two problems here:
watchoption from configsnitin315 commentedon Oct 13, 2020
@evilebottnawi fixed with #1931 ?
alexander-akait commentedon Oct 13, 2020
@snitin315 No, will be fixed in the near future, the next PR
alexander-akait commentedon Oct 16, 2020
Some problems on webpack side with new API, we are working on it, so I will do release with other fixes, but it will be fixed tomorrow with patch release
gimmi commentedon Oct 18, 2020
Same problem for me when trying to upgrade to
[email protected]and[email protected]alexander-akait commentedon Oct 19, 2020
@gimmi why need to spam it? I've always tried to figure it out, but I can't, can you explain it to me?
alexander-akait commentedon Oct 19, 2020
Just note, this is unnecessary using
--watchandwatch: truetogether, just removewatch: truefrom the configjakebailey commentedon Oct 21, 2020
I hit this with the latest versions of everything and I don't have
watch: trueset, so I don't think this config option being duplicated is the whole story.alexander-akait commentedon Oct 21, 2020
@jakebailey Can you provide link on example of problem, removing
watch: trueshould help16 remaining items
thisVioletHydra commentedon Oct 27, 2020
nestorvanz commentedon Oct 31, 2020
I did update to
"webpack": "^5.3.2"and the error still appearsjdelStrother commentedon Nov 4, 2020
I think we're still waiting on a new release ( > 4.1.0 ) for this. If I test against the master branch it seems to work fine.
(You can use the master branch with
yarn add --dev https://gitpkg.now.sh/webpack/webpack-cli/packages/webpack-cli)EDIT:
which is weird because allegedly 4.1.0 was the one that fixed watch mode. I'm still trying to narrow down exactly what fixed it...The deprecation warning was fixed in 2cb0c0ealexander-akait commentedon Nov 4, 2020
Release will be today
alexander-akait commentedon Nov 4, 2020
Fixed in
[email protected], if somebody faced with the problem again, please open a new issue with reproducible test repo, because we tests most of cases 😄xccjk commentedon Dec 16, 2020
I still have this problem!
"webpack": "^5.10.3",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.11.0"
node: v14.15.0
npm: 6.14.8
mac: 10.14.6
github
pedro-w commentedon Dec 16, 2020
@xccjk I did a fresh checkout of your https://github.com/xccjk/webpack-demo1 and didn't see this problem.
I did see a "DEP_WEBPACK_COMPILATION_ASSETS" but this comes from
html-webpack-pluginxccjk commentedon Dec 16, 2020
Thank you very much for your reply, but after removing
html-webpack-plugin, I still have the same problem. I updated the github address after removing redundant packageslebadapetru commentedon Feb 17, 2021
"webpack": "^5.12",and this still occursalexander-akait commentedon Feb 17, 2021
You need update
webpack-clito the latest stable versionlebadapetru commentedon Feb 17, 2021
i'm not actually using pure webpack but webpack encore which uses webpack-cli 4, i see that 4.5 is the latest version but i guess i'll have to wait for webpack encore to upgrade it
chadleong commentedon Feb 17, 2021
Running latest webpack 5.22 and webpack-cli 4.5 - No errors !
PeterBowater commentedon May 25, 2021
Once I had updated webpack-cli it was all good :)
xeroxstar commentedon Dec 10, 2021
"webpack": "^5.61.0" getting same warning when I set the watch property value to
truein the config file and running this code:if I set to
falsethe watch property value in config so the warning is gone. Anyway, this warning I guess is harmless so it's not big deal.