10up-toolkit icon indicating copy to clipboard operation
10up-toolkit copied to clipboard

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

Open marcoluzi opened this issue 6 months ago • 0 comments

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

  • Device: MacBook
  • OS: macOS 14.5
  • Node Version: v18 and v20
  • Yarn Version: v1.22.22 and v4.4.0

WordPress information

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

marcoluzi avatar Aug 06 '24 09:08 marcoluzi