10up / 10up-toolkit

Official 10up asset building toolkit.
114 stars 19 forks source link

TypeError for missing callback function when closing out of --watch mode #418

Open marcoluzi opened 3 months ago

marcoluzi commented 3 months ago

Describe the bug

When closing out of yarn 10up-toolkit build --watch using ctrl + c the following error is displayed:

 closing watch compilation

/Users/marcoluzi/Documents/toolkit-test/node_modules/webpack/lib/HookWebpackError.js:68                                                                                                                                                                                                                             
                callback(null, result);
                ^

TypeError: callback is not a function
    at /Users/marcoluzi/Documents/toolkit-test/node_modules/webpack/lib/HookWebpackError.js:68:3
    at Hook.eval [as callAsync] (eval at create (/Users/marcoluzi/Documents/toolkit-test/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:23:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/marcoluzi/Documents/toolkit-test/node_modules/tapable/lib/Hook.js:18:14)
    at Cache.shutdown (/Users/marcoluzi/Documents/toolkit-test/node_modules/webpack/lib/Cache.js:156:23)
    at /Users/marcoluzi/Documents/toolkit-test/node_modules/webpack/lib/Compiler.js:1378:15
    at Hook.eval [as callAsync] (eval at create (/Users/marcoluzi/Documents/toolkit-test/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/marcoluzi/Documents/toolkit-test/node_modules/tapable/lib/Hook.js:18:14)
    at Compiler.close (/Users/marcoluzi/Documents/toolkit-test/node_modules/webpack/lib/Compiler.js:1371:23)
    at /Users/marcoluzi/Documents/toolkit-test/node_modules/webpack/lib/Compiler.js:1367:10
    at shutdown (/Users/marcoluzi/Documents/toolkit-test/node_modules/webpack/lib/Watching.js:484:38)

Node.js v18.19.0

Hitting ctrl + c a second time will eventually close out of watch mode.

The bug started occuring in the Toolkit version 6.2.0-next.4, most likely in the commit https://github.com/10up/10up-toolkit/commit/dcc09bbb403062de4c1d1b3047902041bb54d959 .

Steps to Reproduce

Tested in a seperate folder without any other dependencies and in two wordpress themes.

  1. yarn add -D 10up-toolkit @10up/babel-preset-default
  2. yarn 10up-toolkit build --watch
  3. ctrl + c

Screenshots, screen recording, code snippet

No response

Environment information

WordPress information

No response

Code of Conduct