Next.js Discord

Discord Forum

Deploy a Nextjs project as a single javascript file

Unanswered
Havana posted this in #help-forum
Open in Discord
HavanaOP
Hi everyone,

I have created a chatbot using nextjs. Now I want to export that projext to a single javascript file along with the assets files. Because of that, I can paste the bundled javascript link as a script to any website header, then the chat widget is appearing on there. I tried webpack and rollup but both of them were not working well.

I tried to use iframe embedding method as well with the next js project deployment link, but that;s also not working. Because when I added the chatbot as a iframe, website buttons are not clickable because of the iframe is coming over the website content.


Do you guys have any idea how to do that? Please anyone suggest a proper solution for me to do that.

2 Replies

nextjs is not suitable for a single widget. you should use pure react for that.

nextjs needs control of the whole html dom and preferably has control of the whole server-client system. it's a full stack framework.
HavanaOP
Thanks for letting me know. Appreciate the help.