When running nuxt generate a file placed in dist/_nuxt/node_modules/commons.[hash].js is created. When deploying to Cloudflare Workers Site any directory and it's sub-content in node_modules is ignored. Including it into Cloudflare breaks the application, so the only work-around I have found is to manually move commons.[hash].js out of the node_module directory and refactor all references to that file. This is error-prone and cumbersome work to do every time.
Either being able to control where commons.[hash].js should be placed or have a property flag placing it directly inside the _nuxt directory. This could be configurable as a property to generate inside nuxt.config.js.
Writing a PowerShell (or similar) script that can be run before deploying to Cloudflare Workers Site that does the moving and replacement.
After this has been implemented it should be fairly straight forward to contribute to your documentation of how to deploy to Cloudflare Workers Site.
Same on netlify.com. dist/_nuxt/node_modules/commons.[hash].js is generated, but ignored by netlify CDN.
NuxtJS v2.14.1
nuxt-i18n v6.13.7
Problem since upgrade to NuxtJS v 2.14.x
Same problem with Firebase and NuxtJS v2.14.1 with nuxt build. Downgraded to NuxtJS v2.14.0 and there is no node_modules folder in the build folder and everything works again.
Same issue if you use app,yml to push to a google app engine, the node_modules/ files in dist are ignored (as in not uploaded)
As a quick note, editing your .gloudignore file and changing:
# Node.js dependencies:
node_modules/
to:
# Node.js dependencies:
/node_modules/
Does address this. Naturally node_module folders in anything other than the root would be uploaded, but that's probably not a big concern for most?
Can confirm the same issue on Vercel (static deployment) using full static mode.
The file dist/_nuxt/node_modules/common.[hash].js is ignored, thus breaking all client-side dynamic behavior.
Adding !_nuxt/node_modules/ in .vercelignore does not fix the issue.
Issue since Nuxt.js 2.14.1. Reverting to Nuxt.js 2.14.0 fixes the issue.
FYI, updating to Nuxt.js 2.14.2 (and 2.14.3) fixed this issue by reverting placing common.js to vendor directory instead of node_modules.
Main issue is #7901
Most helpful comment
Can confirm the same issue on Vercel (static deployment) using full static mode.
The file
dist/_nuxt/node_modules/common.[hash].jsis ignored, thus breaking all client-side dynamic behavior.Adding
!_nuxt/node_modules/in.vercelignoredoes not fix the issue.Issue since Nuxt.js 2.14.1. Reverting to Nuxt.js 2.14.0 fixes the issue.