framework icon indicating copy to clipboard operation
framework copied to clipboard

feat(vite): enable `vite-node` by default

Open antfu opened this issue 3 years ago • 6 comments

🔗 Linked issue

#5018

❓ Type of change

  • [ ] 📖 Documentation (updates to the documentation or readme)
  • [ ] 🐞 Bug fix (a non-breaking change that fixes an issue)
  • [ ] 👌 Enhancement (improving an existing functionality like performance)
  • [x] ✨ New feature (a non-breaking change that adds functionality)
  • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

📝 Checklist

  • [ ] I have linked an issue or discussion.
  • [ ] I have updated the documentation accordingly.

antfu avatar Jul 29 '22 08:07 antfu

Deploy Preview for nuxt3-docs canceled.

Name Link
Latest commit 4a12278e1cf01848c8df2030e2f062351f8646e6
Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/62f79b1000eb070009e2a401

netlify[bot] avatar Jul 29 '22 08:07 netlify[bot]

This will broke all guys which use docker for develop in Nuxt: https://github.com/nuxt/nuxt.js/issues/13587

misaon avatar Jul 29 '22 12:07 misaon

Thanks for the notice @misaon. Do you mind creating a new issue for vite-node+docker with your docker[compose] file to reproduce?

pi0 avatar Jul 29 '22 12:07 pi0

@pi0 I can create a sandbox where the bug can be simulated. However, as has already been written in the thread, the bug manifests itself randomly. It doesn't seem to have an obvious cause, it's just that during development (editing components, pages, composables) a situation arises where the bug appears. In our team, where we develop in Docker projects built on Nuxt, the problem happens randomly to everyone.

We have found that if this error appears in the console, we have to make a change in some vue file (sometimes several times) to get the watcher to start again and work properly. We use the simplest form of Dockerfile

FROM node:18.6.0-alpine3.15 as nuxtBuild

WORKDIR /app

COPY ./ ./

RUN yarn install \
    && yarn run build


FROM node:18.6.0-alpine3.15

ENV HOST=0.0.0.0
WORKDIR /app

COPY --from=nuxtBuild /app/.output /app/.output

It is possible that this is the fault of the Alpine distribution itself, but it is on this distribution that NodeJS officially publishes its docker images.

misaon avatar Jul 29 '22 12:07 misaon

I can confirm the same issue. It seems not even limited to docker but any Linux/Windows env, HMR watcher is ignored for server and only applied to the client, therefore, having hydration mismatch.

I've converted PR to draft until we solve this. ~> nuxt/nuxt.js#14469

It might be related to issue nuxt/nuxt.js#12822 since now client HMR on linux works and Server not (in current nuxt, it is otherwise). But also trying CHOKIDAR_USEPOLLING=1 I still have issue.

pi0 avatar Jul 29 '22 13:07 pi0

Good work @pi0! ❤️

misaon avatar Jul 29 '22 15:07 misaon