-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Layers make nuxt scan too many directories, if the layer has non app related sibling directories #30137
Comments
Since you pinged the nitro PR, this is the inline rollup plugin pi0 created, which counts number of resolved files during the build phase. If you suspect your issue has something to do with scanning unrelated files, it may help you confirm the theory. Furthermore you can modify it slightly to log the resolved path and look for something which shouldn't be there (usually rollupConfig: {
plugins: [
(() => {
let count = 0;
const ids = new Set();
return {
name: "resolve-counter",
resolveId(id) {
ids.add(id);
count++;
},
generateBundle() {
console.log(
`🚀 Total ${count} modules resolved, ${ids.size} unique`
);
},
};
})(),
],
}, |
Maybe i was a bit too hasty on the ping.
|
I tracked it down to the usage of
|
I'm also experiencing this issue. Downgrading |
Dev from tinyglobby got back to me.
|
@fabianwohlfart Thanks! For my learning, what is the advantage of using the |
@davidstackio My take is that it's better to use a future version of something instead of locking into an old version. |
cc: @antfu |
Linking to the upstream issue: SuperchupuDev/tinyglobby#77 Will update the deps when they release a stable new version |
This is also the reason we cannot upgrade to latest |
|
Downgrading to previous version and updating to latest version of the denishsharma/nuxt-layer-startup-time-issue-repo With Nuxt 4 directory structureThe below one is with the workaround provided above. Without Nuxt 4 directory structure (but uses compatibilityVersion: 4) |
@denishsharma to benefit from the v4 features, make sure your layer is also using |
@danielroe exponential increase in startup time using layers with v4 compatibility still persists, even after updating my layer and project to use Fallback to using v3 directory structure for layer and project, resolves this issue, regardless of setting Tested both on latest version of |
@denishsharma The latest version of Nuxt is v3.15.2 (released two days ago) which contains some speed up but I think the issue here might be resolved in #30620 - I'll need to confirm, or you can try with |
@danielroe issue still persists even with nightly release Using
|
I could also check it if it's related to my original problem. yet i would need a reproduction. can you share your code in a github repo or a stackblitz? |
@danielroe @fabianwohlfart I have encountered strange behaviour with layers (with new directory structure), somehow, when I add empty "app" folder, the exponential increase in startup time resolves. I have no idea if this is a bug, or "app" folder is mandatory with new directory structure. Here is the demo repo: (playground does not even use anything from layer, nor does layer exports anything) When there is no
|
Environment
Reproduction
https://github.com/fabianwohlfart/test__nuxt-layers-slowdown
Describe the bug
I have a layer repo which is used by multiple websites.
It it located as a sibling / parallel to all the other website folders.
If I move this layer repo inside my website layer everything works as expected.
The moment I move it to a parent folder nuxt slows down with the warning
WARN Slow module imports took 10219.28ms to setup.
The moment I move it to my User folder the OS asks me for permission to access certain folders. That's why I assume that siblings are scanned too.
As it is not possible for me to give you a reproduction with all my folders.
Yet I simplified it to a setup where we have one folder as a sibling with 250k js files.
If this folder exists it slows down nuxt significantly, but should not, as I don't expect it to be part of my app.
Without this folder
With this folder
Original speed when my layer repo is a sibling of my website repos
Additional context
No response
Logs
The text was updated successfully, but these errors were encountered: