Nuxt.js: Placing development directories in production should be configurable

Created on 5 Aug 2020  路  6Comments  路  Source: nuxt/nuxt.js

Is your feature request related to a problem? Please describe.

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.

Describe the solution you'd like

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.

Describe alternatives you've considered

Writing a PowerShell (or similar) script that can be run before deploying to Cloudflare Workers Site that does the moving and replacement.

Additional context

After this has been implemented it should be fairly straight forward to contribute to your documentation of how to deploy to Cloudflare Workers Site.

feature-request

Most helpful comment

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.

All 6 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shyamchandranmec picture shyamchandranmec  路  3Comments

mikekidder picture mikekidder  路  3Comments

lazycrazy picture lazycrazy  路  3Comments

danieloprado picture danieloprado  路  3Comments

maicong picture maicong  路  3Comments