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

DEP_WEBPACK_WATCH_WITHOUT_CALLBACK when watch is true #2089

Closed
yossi-nagar opened this issue Nov 9, 2020 · 6 comments
Closed

DEP_WEBPACK_WATCH_WITHOUT_CALLBACK when watch is true #2089

yossi-nagar opened this issue Nov 9, 2020 · 6 comments
Labels

Comments

@yossi-nagar
Copy link

When trying to invoke the webpack-dev-server with watch option i get this warning:
10% building 0/10 entries 0/9 dependencies 0/0 modules(node:42260) [DEP_WEBPACK_WATCH_WITHOUT_CALLBACK] DeprecationWarning: A 'callback' argument need to be provided to the 'webpack(options, callback)' function when the 'watch' opt ion is set. There is no way to handle the 'watch' option without a callback.

I am using the command webpack serve --mode development --progress -m -c ./webpack.common.js -c webpack.dev.js

Not only i receive this warning but the browser is also not reloaded when i make a change although I see that webpack recompiles my code.

dependencies in package.json:

"dependencies": {
    "@babel/runtime": "^7.12.1"
  },
  "devDependencies": {
    "@babel/core": "^7.12.3",
    "@babel/plugin-transform-modules-commonjs": "^7.12.1",
    "@babel/plugin-transform-runtime": "^7.12.1",
    "@babel/preset-env": "^7.12.1",
    "babel-loader": "^8.1.0",
    "clean-webpack-plugin": "^3.0.0",
    "compression": "^1.7.4",
    "cookie-parser": "^1.4.5",
    "core-js": "^3.7.0",
    "css-loader": "^5.0.1",
    "css-minimizer-webpack-plugin": "^1.1.5",
    "execution-time": "^1.4.1",
    "file-loader": "^5.1.0",
    "glob": "^7.1.6",
    "glob-promise": "^3.4.0",
    "handlebars": "^4.7.6",
    "html-loader": "^0.5.5",
    "html-minimizer-webpack-plugin": "^1.0.1",
    "html-webpack-plugin": "^5.0.0-alpha.13",
    "http-proxy-middleware": "^0.20.0",
    "jquery": "^3.5.1",
    "jquery-once": "^2.2.3",
    "jquery.marquee": "^1.5.0",
    "lightslider": "^1.1.6",
    "loadcss": "0.0.2",
    "lodash": "^4.17.20",
    "mini-css-extract-plugin": "^1.3.0",
    "moment": "^2.29.1",
    "moment-locales-webpack-plugin": "^1.2.0",
    "morgan": "^1.10.0",
    "numeral": "^2.0.6",
    "prismic-dom": "^2.2.4",
    "prismic-javascript": "^2.7.1",
    "regenerator-runtime": "^0.13.7",
    "resource-hints-webpack-plugin": "0.0.2",
    "script-loader": "^0.7.2",
    "style-loader": "^2.0.0",
    "terser-webpack-plugin": "^5.0.3",
    "url-loader": "^4.1.1",
    "webpack": "^5.3.2",
    "webpack-bundle-analyzer": "^3.9.0",
    "webpack-cli": "^4.2.0",
    "webpack-dev-middleware": "^4.0.0",
    "webpack-dev-server": "^3.11.0"
  },

webpack config:

const path = require("path");
const fs = require("fs");
const cookieParser = require("cookie-parser");
const pages = require("./routing.config");

let results =  {
    mode: "development",
    devtool: "source-map",
    watch: true,
    watchOptions: {
        ignored: /node_modules/
    },
    devServer: {
        port: 443,
        hot: false,
        liveReload: true,
        https: true,
        writeToDisk: true,
        historyApiFallback: true,
        disableHostCheck: true,
        open: 'chrome',
        contentBase: path.resolve(__dirname, "dist/"),
        compress: true,
        publicPath: "/",
    },
};
module.exports = results;

What is the current behavior?

Expected behavior
Expected not to see this warning after closing issue #1918

Please paste the results of webpack-cli info here, and mention other relevant information

System:
OS: Windows 10 10.0.18363
CPU: (8) x64 Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
Memory: 4.24 GB / 15.96 GB
Binaries:
Node: 12.18.3 - C:\Program Files\nodejs\node.EXE
npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 86.0.4240.183
Edge: Spartan (44.18362.449.0)
Internet Explorer: 11.0.18362.1
Packages:
clean-webpack-plugin: ^3.0.0 => 3.0.0
css-minimizer-webpack-plugin: ^1.1.5 => 1.1.5
html-minimizer-webpack-plugin: ^1.0.1 => 1.0.1
html-webpack-plugin: ^5.0.0-alpha.13 => 5.0.0-alpha.13
moment-locales-webpack-plugin: ^1.2.0 => 1.2.0
resource-hints-webpack-plugin: 0.0.2 => 0.0.2
terser-webpack-plugin: ^5.0.3 => 5.0.3
webpack: ^5.3.2 => 5.4.0
webpack-bundle-analyzer: ^3.9.0 => 3.9.0
webpack-cli: ^4.2.0 => 4.2.0
webpack-dev-middleware: ^4.0.0 => 4.0.0
webpack-dev-server: ^3.11.0 => 3.11.0

Additional context
Please see #1918

@yossi-nagar yossi-nagar added the Bug label Nov 9, 2020
@alexander-akait
Copy link
Member

Please create minimum reproducible test repo, should be fixed in 4.2.0

@yossi-nagar
Copy link
Author

Please create minimum reproducible test repo, should be fixed in 4.2.0

@evilebottnawi you can clone this one https://github.com/yossi-nagar/webpack5-test

@alexander-akait
Copy link
Member

alexander-akait commented Nov 10, 2020

Just remove watch: true from webpack.dev.js, it doesn't have sense, so webpack says it, maybe some misleading, also fixed in webpack-dev-middleware, hope we will do webpack-dev-server release in near future, not related to webpack-cli

@yossi-nagar
Copy link
Author

i removef watch: true from webpack.dev.js and still i am receiving the same error

@yossi-nagar
Copy link
Author

Sorry my bad. The watch: true option was removed and also no --watch in the cli command. However i didn't manage to reach a situation where i change something in index.js and the browser is refreshed too. @evilebottnawi can you help on that one?

@alexander-akait
Copy link
Member

@yossi-nagar no deprecations, target: "web", to webpack.dev.js

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

No branches or pull requests

2 participants