nuxt / nuxt

The Intuitive Vue Framework.
https://nuxt.com
MIT License
54.95k stars 5.03k forks source link

Hot-update.json 404. #19637

Closed v3nt closed 1 year ago

v3nt commented 1 year ago

nuxt@2.16.1

Environment

kx yapily-ui-dashboard-698f774889-bgxdj sh /src $ npx nuxi info npx: installed 1 in 1.85s Nuxi 3.2.3 10:17:58 10:17:59 RootDir: /src 10:17:59 Nuxt project info: 10:17:59


Reproduction

Every deployment now. npm run build

Describe the bug

Basically can't find this file /_nuxt/171b24e9608b53bc36dd.hot-update.json

The filename changes with each build / deployment but it always seems to be this file /_nuxt/ x.hot-update.json

Additional context

(App is behind a VPN so can't provide access)

Logs

No response

danielroe commented 1 year ago

Would you provide a reproduction? 🙏

v3nt commented 1 year ago

Hi. We can't reproduce it locally. Only on Dev. Any files I can add here that will help?

v3nt commented 1 year ago
image
danielroe commented 1 year ago

I'm confused, because you said that "the filename changes with each build / deployment". I was assuming that this issue is present in production, but you're saying you can only reproduce in development?

rafaelmagalhaes commented 1 year ago

Hey @danielroe I got a reproduction of this here https://github.com/nuxt/nuxt/discussions/19978

rafaelmagalhaes commented 1 year ago

using NODE_ENV set to production stops the reloading, but we want to deploy this in development environment and NODE_ENV is set to development

danielroe commented 1 year ago

Are you running nuxt build with NODE_ENV set to development?

rafaelmagalhaes commented 1 year ago

Yeah it's set to development for our development build,

rafaelmagalhaes commented 1 year ago

found something, npm start command is calling the file server/index.ts

const express = require('express');
const consola = require('consola');
require('dotenv').config();
const { Nuxt, Builder } = require('nuxt');
const appConsole = express();

// Import and Set Nuxt.js options
const config = require('../nuxt.config.ts');
config.dev = process.env.NODE_ENV !== 'production';

async function start() {
  // Init Nuxt.js
  const nuxt = new Nuxt({
    ...config,
    env: {
      baseURL: process.env.baseURL,
      googleAnalytics: process.env.googleAnalytics,
      flagBaseUrl: process.env.flagBaseUrl,
      ADMIN_MODE: process.env.ADMIN_MODE,
    },
  });

  const { host, port } = nuxt.options.server;

  await nuxt.ready();
  // Build only in dev mode
  if (config.dev) {
    const builder = new Builder(nuxt);
    await builder.build();
  }

  // Give nuxt middleware to express
  appConsole.use(nuxt.render);

  // Listen the server
  appConsole.listen(port, host);
  consola.ready({
    message: `Server listening on https://${host}:${port}, environment:: ${process.env.NODE_ENV}  baseURL:: ${process.env.baseURL},  googleAnalytics:: ${process.env.googleAnalytics},  YAPILY_UNLEASH_ENDPOINT:${process.env.YAPILY_UNLEASH_ENDPOINT},  ADMIN_MODE:${process.env.ADMIN_MODE} `,
    badge: true,
  });
}
start();

This file somehow started causing the issue I changed the start command to nuxt start and it stopped reloading.

But in production build is using the same file and not reloading the page, also this is not happening locally if I run build and start command