nuxt-community / adonuxt-template

[Deprecated] Starter template for Nuxt.js with AdonisJS.
451 stars 61 forks source link

Nuxt compiles in production mode fix #102

Closed ysfada closed 4 years ago

ysfada commented 6 years ago

90

HapLifeMan commented 5 years ago

Very helpful! It prevents to build for each instance when we run npm run start in production! Can you please merge it @Atinux? 😁🙏🏻

richie3366 commented 5 years ago

Little warning about this PR: it will also overwrite app.context.env.NODE_ENV and cause trouble if you want to share the real env with the client in a pre-built bundle.

A workaround would be to rely on a IS_BUILD env var.

Suggested changes :

package.json

    "build": "cross-env IS_BUILD=1 node ./ace nuxtbuild",

app/Services/Nuxt.js

    if (dev || Env.get('IS_BUILD') === '1')
      return new Builder(this.nuxt).build()