Including additional files in standalone next build
Unanswered
Sun bear posted this in #help-forum
Sun bearOP
I have a
Alternatively, is there a more idiomatic way of creating CLI scripts for Next.js apps? In my case, for running migrations.
I found
migrations.js CLI script in my project folder. Understandably, Next.js doesn't know about this file and doesn't include it or its dependencies in the standalone build. Is there a way to tell Next.js to also include this file in the standalone build, despite it existing outside the standard folders?Alternatively, is there a more idiomatic way of creating CLI scripts for Next.js apps? In my case, for running migrations.
I found
experimental.outputFileTracingIncludes in the docs (https://nextjs.org/docs/app/api-reference/next-config-js/output#caveats), but that didn't seem to work for this use case.1 Reply
Sun bearOP
Related discussion I found:
https://github.com/vercel/next.js/discussions/35792
And another workaround that runs CLI scripts through API routes (but I'd really really really prefer to avoid this):
https://stackoverflow.com/questions/72196364/how-to-run-a-standalone-cli-script-using-a-nextjs-project/73194881#73194881
https://github.com/vercel/next.js/discussions/35792
And another workaround that runs CLI scripts through API routes (but I'd really really really prefer to avoid this):
https://stackoverflow.com/questions/72196364/how-to-run-a-standalone-cli-script-using-a-nextjs-project/73194881#73194881