Skip to content

Commit

Permalink
fix(cli): server should not be initialized in nuxt build (#6441)
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkdo authored and pi0 committed Sep 20, 2019
1 parent 4e4aa4d commit 95e043f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/cli/src/commands/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default {
}
},
async run (cmd) {
const config = await cmd.getNuxtConfig({ dev: false, _build: true })
const config = await cmd.getNuxtConfig({ dev: false, server: false, _build: true })
const nuxt = await cmd.getNuxt(config)

if (cmd.argv.lock) {
Expand Down

3 comments on commit 95e043f

@prashantpalikhe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change right?

In my module, I was relying on the presence of this.nuxt.options.server to pass the server info to the template I would be adding via this.addTemplate. Now, during the build, these options are not present. Only during npm run start, the server value is available but by then the nuxt files are already generated with the server set to false.

What would be other way to get server values in the template file?

@pi0
Copy link
Member

@pi0 pi0 commented on 95e043f Feb 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @prashantpalikhe. Hmm that seems a strange use case because server config can be different after build... Can you probably ref to module code?

@prashantpalikhe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @pi0 I cannot share the module code. But essentially, the module was creating a server middleware endpoint and registering a store. In the store's action, it was using the server options information to formulate the URL to the servermiddleware endpoint. I guess this is indeed a unique use case for us. Since, we have different domains pointing to the same Nuxt instance, so we needed to make a request to the local server on the server side. But we have now fixed it in a different way.

Please sign in to comment.