Build Nuxt 3 as CommonJS
Hello, is there any ways to make Nuxt 3 build output as CommonJS instead of ESM ? The reason is I want to deploy my app into shared hosting using cpanel and they only support node app with CommonJS
5 Replies
Would love to know more about this, having the same issue,
App used to work fine until nuxt 3.11.x. Then somehow something changed, not quite sure what.
I've usually had it working with a loading script, appstart.cjs.
This usually would load, but now it doesn't...
do you found any solution @brunomgmateus ?
I've also tried just loading:
and so far has been working. But on Nuxt 3.11
Sorry for the late reply, but just to let you know that I've come accross an issue where, if you're using the setting "experimental.writeEarlyHints" in nuxt.config.ts, it breaks production version in cPanel, Plesk (and other serverrs that use either nginX or Phusion Passenger).
This was true for the latest Nuxt version.
so I guess we cannot deploy to shared hosting anymore
cuz I also need latest version of nuxt
You just need to disable the "experimental.writeEarlyHints" in nuxt config. SHould work well