S-IAF
Join ServerSapphire - Imagine a framework
sapphire-support
HMR not Working correctly
CChillihero1/15/2023
I am using the
When I change the text in an embed for example and hmr reloads my changes, they are displayed correctly in discord with the new text.
If you change console logs, add
If I want to see the changes I have to stop the dev process and restart the bot completely.
Is this wanted behavior or am I doing something wrong?
@sapphire/plugin-hmr
Plugin to reload my bot on code changes without relogging to discord.When I change the text in an embed for example and hmr reloads my changes, they are displayed correctly in discord with the new text.
If you change console logs, add
container.logger.info(xyz)
or edit helper files, the changes there are not reflected correctly with the latest changes.If I want to see the changes I have to stop the dev process and restart the bot completely.
Is this wanted behavior or am I doing something wrong?
MMimu1/15/2023
Probably use the watch script like
tsc --watch yourfile.js
CChillihero1/15/2023
I run npm run dev.
npm run dev
runs run-p watch start
watch
= tsc -w
start
= node dist/index.js
Solution
LLioness1001/15/2023
This is expected behavior. @sapphire/plugin-hmr only handles "piece" files (commands, listeners, preconditions, etc)
LLioness1001/15/2023
What you might be able to do is change and save a helper file, and then change and save a command file that uses it. This forces the command to reload, which would reimport the helper file with the new changes
LLioness1001/15/2023
I'm not sure if that works but it would be worth a try
CChillihero1/15/2023
tried and its not working :(
CChillihero1/15/2023
an option to reload on all file changes would be dope tbh
FFavna1/15/2023
that won't really be added because there is no good way to reload files in a running process anyway
FFavna1/15/2023
in CJS there is require cache, and in ESM you can add query params to imports but both are very so/so
FFavna1/15/2023
You can add it to your own bot or make your own plugin, but we won't be adding it