-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Circular dependency in nuxt with nitropack #18789
Comments
Related #18766 (?) |
this might be related, i'm using 3.1.2 while @Barbapapazes is using 3.1.1. |
There is similar issue raised at nuxt content repo |
I previously had cloudflare deployment failing with this circular dependency warning. However, this was problem with the build output directory in cloudflare, because I just managed to resolve the deployment failure by specifying .output/public as the Build output directory. Previously I was using default dist folder as the output directory. |
Can you give an example of the file and code? |
So I had my blog failing deployment originally, so I made this repo with fresh nuxt setup for testing purpose. Both of them were failing in deployment but that was because in Cloudflare setting, I was using the default This might still be related to the circular dependency issue though because my deployment was working fine with default dist folder previously. |
same problem here, generated a basic ssg with only i18n static site, the static version goes in an inifinite loop loading, the ssr instead seems work correctly, but i need ssg you can check here #18876 |
cc: @pi0 |
I continue to get the message Nuxt project info: 09:03:47
|
@StefanoTesla probably because the fix not released yet, just merged, right? Edit: oh I see a new nuxt version has been released 1hr ago.. awesome 💚💚🎉🎉 |
I seen the merged changes reflected to the My repo. |
Fix is released in nitro 2.2.1 but nuxt 3.2.0 use nitro 2.2.0 |
Nuxt 3.2.0 dependency use
|
I hope issue is fixed in last release. You can try nuxi upgrade —force in cast of 2.2.1 reproducing issues, please ping me with a reproduction to reopen :) |
Hi @pi0
Thank you |
@ram-you Could you please provide a reproduction? 🙏 |
|
Hi @manniL |
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
Thanks! Can be reproduced with a clean starter running |
Indeed, it's still present in 3.2.0, but it should be resolved in the edge channel, or in the next release. |
Thank you for clarification 🙂 |
I get this error with a fresh package and the
server/api/test.js
|
Thanks for the report. Raised #22785. |
I'm seeing a similar circular dependency in Nuxt 3.8.2 with Nitro 2.8.1 (and Nuxt 3.8.0 before I tried an update) where
And these errors when I run the build command
At first, I suspected this was due to a use of |
I also started seeing this again (reference nuxt-modules/og-image#122).
|
To provide a little more context for my previous comment, I did some digging in the generated In my file it starts with this block at line 920: const config$1 = useRuntimeConfig();
const _routeRulesMatcher = toRouteMatcher(
createRouter({ routes: config$1.nitro.routeRules })
);
function createRouteRulesHandler(ctx) {
return eventHandler((event) => {
const routeRules = getRouteRules(event);
if (routeRules.headers) {
setHeaders(event, routeRules.headers);
}
if (routeRules.redirect) {
return sendRedirect(
event,
routeRules.redirect.to,
routeRules.redirect.statusCode
);
}
if (routeRules.proxy) {
let target = routeRules.proxy.to;
if (target.endsWith("/**")) {
let targetPath = event.path;
const strpBase = routeRules.proxy._proxyStripBase;
if (strpBase) {
targetPath = withoutBase(targetPath, strpBase);
}
target = joinURL(target.slice(0, -3), targetPath);
} else if (event.path.includes("?")) {
const query = getQuery(event.path);
target = withQuery(target, query);
}
return proxyRequest(event, target, {
fetch: ctx.localFetch,
...routeRules.proxy
});
}
});
} That is being imported from However the definition of const _sharedRuntimeConfig = _deepFreeze(
_applyEnv(klona(_inlineRuntimeConfig))
);
function useRuntimeConfig(event) {
if (!event) {
return _sharedRuntimeConfig;
}
if (event.context.nitro.runtimeConfig) {
return event.context.nitro.runtimeConfig;
}
const runtimeConfig = klona(_inlineRuntimeConfig);
_applyEnv(runtimeConfig);
event.context.nitro.runtimeConfig = runtimeConfig;
return runtimeConfig;
}
const _sharedAppConfig = _deepFreeze(klona(appConfig));
function useAppConfig(event) {
if (!event) {
return _sharedAppConfig;
}
if (event.context.nitro.appConfig) {
return event.context.nitro.appConfig;
}
const appConfig$1 = klona(appConfig);
event.context.nitro.appConfig = appConfig$1;
return appConfig$1;
} So as far as I can tell, This is currently blocking us from running the dev environment locally and I cannot tell if this is just a import or reference I need to move around or if this is something inside of Nitro. If it is helpful I can move this to a new bug report. |
Given the detailed description, I reopen this issue. |
That looks like it might be a nitropack issue... What do you think @pi0? |
Is there a recent minimal reproduction based on either Nuxt or Nitro latest versions? |
Would you be able to provide a reproduction? 🙏 More infoWhy do I need to provide a reproduction?Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making. What will happen?If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritize it based on its severity and how many people we think it might affect. If How can I create a reproduction?We have a couple of templates for starting with a minimal reproduction: 👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz A public GitHub repository is also perfect. 👌 Please ensure that the reproduction is as minimal as possible. See more details in our guide. You might also find these other articles interesting and/or helpful: |
I can try to track down a minimal reproduction of the issue. I am not sure exactly what triggered the issue originally as it occured during my projects transition from Nuxt 2 to Nuxt 3. I suspect maybe it was when we introduced custom router rules but I will see if I can make a new repo with the issue. |
Ah I found the issue. We had a config that was being imported into our core layer's app config. That config was importing composable functions. When I commented those out the error went away. I'm going to rework the config so that we don't directly import those composables into the config. Just a casualty of converting a lot of JSON based configs into one main app.config.ts file. |
So, it was a project-specific issue, not something to fix in Nuxt? Then I'd close this issue again 🙌 |
Yes this can be closed out again. Sorry for the confusion |
I can reproduce with Nuxt 3.10.1, Nitropack 2.8.1
Here is the link to reproduction: https://codesandbox.io/p/sandbox/quirky-lovelace-pd9l7w |
Getting the same errors on my build too, which uses nitro plugins.. |
please open a new issue with reproduction 🙏🏼 |
Did you guys try this? #22785 (comment)
|
@fabianwohlfart This indeed suppressed the error |
Environment
Windows_NT
v16.17.0
3.1.2
2.1.1
yarn@1.22.18
vite
-
-
-
and stackblitz
Reproduction
https://stackblitz.com/edit/nuxt-starter-kqf57y?file=README.md
Describe the bug
Hi 👋 !
Nuxt build in 3.1.2 logs a warning about circular dependency
Additional context
No response
Logs
The text was updated successfully, but these errors were encountered: