Comments (12)
Also for dev environment it delays everything except entry.mjs, but in production it delays nothing in the init mode.
from nuxt-delay-hydration.
Fix is available in 1.2.1 thanks for @jbmolle :)
from nuxt-delay-hydration.
Issue is fixed for nuxt <= 3.6.5, but in nuxt 3.7.x plugin detected the mode and started working but something has changed (about htmlContext structure from render:html hook i guess), so it don't actually delay things in the init mode, need to reopen and fix
from nuxt-delay-hydration.
I was about to post an issue for this, but looks like it is fixed in nuxt <= 3.6.5 like @zhaivoronok mentioned, mount mode is working as expected though.
My versions:
node: 16.20.0
nuxt: 3.7.1
nuxt-delay-hydration: 1.2.2
from nuxt-delay-hydration.
Can you confirm which module version / nuxt version you're using?
Seems to be working correctly for me in Nuxt 3
from nuxt-delay-hydration.
Can you confirm which module version / nuxt version you're using?
Seems to be working correctly for me in Nuxt 3
macOS: Ventura 13.2
node: 18.14.0
nuxt: 3.2.0
nuxt-delay-hydration: 1.1.4
from nuxt-delay-hydration.
So I figured out what's happened, if I set some variable in runtimeConfig public to process.env.NODE_ENV === 'development'
or even process.env.NODE_ENV !== 'production'
, it stops to work 😶 (So checking if current environment is true). Tested it in clean Nuxt 3 installation.
Full nuxt.config.js:
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
modules: [
'nuxt-delay-hydration'
],
delayHydration: {
mode: 'init',
// enables nuxt-delay-hydration in dev mode for testing
debug: process.env.NODE_ENV === 'development'
},
runtimeConfig: {
public: {
someVariable: process.env.NODE_ENV === 'development'
}
}
})
EDIT: setting true to runtimeConfig public variable is the issue.
from nuxt-delay-hydration.
Hi,
First thanks @harlan-zw for this great module!
I have the same problem 'init' mode is not working but 'mount' is.
When I looked at the nitro plugin, it defines the variable isPageSSR to true if ssrContext includes serverRendered:true
But in my case my ssrContext gives me this:
from nuxt-delay-hydration.
Can you please tell me one thing if we have used init mode, then all javascript will be delay, but if we have used init mode and after that TBT is 0. It can impact on LCP and FCP ?
FCP and LCP will be optimized or not ?
After I used init mode then FCP and LCP was metrics same as before.
from nuxt-delay-hydration.
Actually I think the 2 scripts @vite/client
and app/entry.js
are not delayed anymore.
They used to be in htmlContext.bodyAppend and so we could extract them and add them after _$delayHydration is done.
But since nuxt 3.7.0, those scripts are in the manifest which can be access at build time on nuxt build:manifest hook
from nuxt-delay-hydration.
The problem is that the entry file (entry.ts or entry.async.ts) is hardcoded in Nuxt.
I've tried to create a customEntry.ts in nuxt-delay-hydration module wich returns entry when on server and window._$delayHydration.then(e => entry(ctx)) on client.
I then managed to change the entrypoint in the module by calling the vite:extend hook with viteBuildContext.entry = 'path_of_nuxt_delay_hydration/dist/customEntry.mjs'
Server side it works but client side the app I get 404 in development mode. The file path for the entry should be /_nuxt/node_modules/nuxt-delay-hydration/customEntry.mjs
but it is /_nuxt/node_modules/nuxt/dist/app/customEntry.mjs
@harlan-zw do you know if it is possible to hook on Nuxt entry.ts to run specific code before calling Nuxt entry?
from nuxt-delay-hydration.
I believe this got fixed
from nuxt-delay-hydration.
Related Issues (20)
- Uncaught SyntaxError: Identifier `w` has already been declared
- Nuxt Fatal Error with ```npm run dev``` after installing the module HOT 5
- Uncaught (in promise) ReferenceError: TouchEvent is not defined HOT 1
- Nuxt Fatal Error HOT 1
- DelayHudration config object gives typescript not exist error HOT 3
- hmr breaks using nuxt delay hydration HOT 1
- Preview Mode (SSG) HOT 1
- Different nuxtData index required HOT 1
- Service Worker is not registering on "init mode" HOT 1
- Can hydration delay be set only for mobile devices? HOT 2
- ReferenceError: TouchEvent is not defined - happening with replayClick on Firefox for Mac HOT 3
- 'manual' mode does not work, behaves same like 'mount' mode HOT 8
- DelayHydration component no longer registered since v1.3.0 HOT 2
- minification of JS
- Can using this module affect indexing when using a "site loader" element?
- Does not work with ApexChart (Manualmode)
- Layout jump when hydration happens HOT 1
- Wrong scroll behaviour when module is manual
- Different behaviour on different mobile devices HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuxt-delay-hydration.