Closed niieani closed 3 years ago
The tool is set here: https://github.com/beemojs/beemo/blob/master/packages/core/src/Tool.ts#L133
Do you have a stack trace? I've never run into this before.
My config doesn't contain any scripts listed, which means that line you cited is run, but doesn't load any scripts. However the scripts don't have to be listed to work, because they're being loaded by RunScriptRoutine
anyway. I've done a little more debugging and it looks like that's where the issue was, tool
wasn't being passed in there.
Made a PR #149.
As the title states,
Script.tool
isundefined
.Reproduction:
Add a
.config/beemo.ts
:Run scaffolding script:
It will crash, because of script.tool being undefined here:
The line has a non-null assertion when it's defined: https://github.com/beemojs/beemo/blob/148035874cd7572aa7c04105b274d452b2e86655/packages/core/src/Script.ts#L14-L15
I've tried going through all the hoops of where
startup
is being run to understand why it's not being set, but I can't find the cause. Must be somewhere deep in@boost/plugin
. When I attach a debugger in startup, it already receivesundefined
under thetool
parameter duringstartup
:https://github.com/beemojs/beemo/blob/148035874cd7572aa7c04105b274d452b2e86655/packages/core/src/Script.ts#L41-L44
Workaround is to add a bootstrap function which sets the missing
tool
:Interestingly, the
onAfterRegister
is being called twice for the same script, not sure why? 🤷