-
Suggestion
-
Resolution: Unresolved
-
None
Hello,
Is it possible to have some sort of pre-deploy or post-deploy hook for things like running scripts on compiled code? For example, in order to make custom UI work, sometimes you have to do some editing before deploying. In Next.JS as an example, you have to modify all the relative urls from /_next/ to ./_next/ in order to make everything click in place. To do this, i have to add a package.json script each time to every small custom UI portion i want to use next.js in.
```
"deploy": "cd frontend && npm run build && cd .. && npm run build-fix && forge deploy",
"build-fix": "find \"dist\" -type f -exec sed -i 's#\"/_next/#\"./_next/#g' {} +"
```
I would love to see this built in to forge. By no means is this an urgent request, its just a matter of copy pasting the script over to new forge projects but something this useful should just be built in.
*Possible Implementation:*
A custom webpack plugin that could be ran when everything is complete with the defaults being set as `dist` or a user could provide it using a forge variable or as an arg to the forge deploy command itself. If you could detect that nextjs is being used and auto enable this hook and provide an option to disable it should the user not want it etc... Apply same logic to other frameworks that need some special handling.
Thank you