HoudiniGraphql / houdini

The disappearing GraphQL framework
http://www.houdinigraphql.com
MIT License
913 stars 99 forks source link

Circular dependencies in $houdini folder #1304

Open shadow-identity opened 5 months ago

shadow-identity commented 5 months ago

Describe the bug

Generated $houdini folder has some circular dependencies across *.js files. It may lead to unpredictable consequences, including vite hangs.

It is reproducible in the example-sveltekit-todo project. The minimal reproduction repo I provide is an example-sveltekit-todo fork, with updated houdini and added vite-plugin-circular-dependency to simplify the search of circular dependencies.

Found circular dependencies are:

  $houdini/runtime/cache/cache.js
    $houdini/runtime/cache/cache.js -> $houdini/runtime/cache/lists.js
    $houdini/runtime/cache/cache.js -> $houdini/runtime/cache/subscription.js

  $houdini/index.js
    $houdini/index.js -> $houdini/plugins/houdini-svelte/runtime/client.js -> $houdini/plugins/houdini-svelte/runtime/stores/mutation.js -> $houdini/plugins/houdini-svelte/stores/AddItem.js -> $houdini/plugins/houdini-svelte/stores/index.js -> src/client.ts
    $houdini/index.js -> $houdini/plugins/houdini-svelte/runtime/client.js -> $houdini/plugins/houdini-svelte/runtime/stores/pagination/query.js -> $houdini/plugins/houdini-svelte/stores/AllItems.js -> $houdini/plugins/houdini-svelte/stores/index.js -> src/client.ts
    $houdini/index.js -> $houdini/plugins/houdini-svelte/runtime/client.js -> $houdini/plugins/houdini-svelte/runtime/index.js -> $houdini/plugins/houdini-svelte/runtime/stores/index.js -> $houdini/plugins/houdini-svelte/runtime/stores/pagination/fragment.js -> $houdini/plugins/houdini-svelte/runtime/stores/pagination/index.js -> src/client.ts
    $houdini/index.js -> $houdini/plugins/houdini-svelte/runtime/client.js -> $houdini/plugins/houdini-svelte/runtime/index.js -> $houdini/plugins/houdini-svelte/runtime/stores/index.js -> $houdini/plugins/houdini-svelte/runtime/stores/pagination/index.js -> $houdini/plugins/houdini-svelte/runtime/stores/pagination/query.js -> src/client.ts

First two are absolutely valid (verified manually), tho I'm not 100% sure about the rest: it is quite hard to go through many of export * from 'foo'.

Reproduction

https://github.com/shadow-identity/example-sveltekit-todo

AlecAivazis commented 4 months ago

Thanks for reporting these. If you have the time/energy to give it a shot i'd gladly offer any assistance you need.

fnimick commented 3 months ago

This is causing regular issues with my project - vite starts fine, but any hot reload has a chance of crashing vite with a circular dependency error in SSR, even when working on pages with no houdini interactions.

fnimick commented 3 months ago
10:17:02 PM [vite] page reload $houdini/runtime/index.js
10:17:02 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/fragments.js
10:17:02 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/index.js
10:17:02 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/session.js
10:17:02 PM [vite] page reload $houdini/runtime/client/index.js
10:17:02 PM [vite] page reload $houdini/runtime/client/documentStore.js
10:17:02 PM [vite] page reload $houdini/runtime/lib/config.js
10:17:02 PM [vite] page reload $houdini/runtime/lib/flatten.js
10:17:02 PM [vite] page reload $houdini/runtime/lib/deepEquals.js
10:17:02 PM [vite] page reload $houdini/runtime/lib/index.js
10:17:02 PM [vite] page reload $houdini/runtime/lib/lru.js
10:17:02 PM [vite] page reload $houdini/runtime/lib/log.js
10:17:02 PM [vite] page reload $houdini/runtime/lib/key.js
10:17:02 PM [vite] page reload $houdini/runtime/lib/pageInfo.js
10:17:02 PM [vite] page reload $houdini/runtime/lib/pagination.js
10:17:02 PM [vite] page reload $houdini/runtime/lib/scalars.js
10:17:02 PM [vite] page reload $houdini/runtime/lib/selection.js
10:17:02 PM [vite] page reload $houdini/runtime/lib/store.js
10:17:02 PM [vite] page reload $houdini/runtime/lib/types.js
10:17:02 PM [vite] page reload $houdini/runtime/public/cache.js
10:17:02 PM [vite] page reload $houdini/runtime/public/index.js
10:17:02 PM [vite] page reload $houdini/runtime/public/record.js
10:17:02 PM [vite] page reload $houdini/runtime/public/list.js
10:17:02 PM [vite] page reload $houdini/runtime/cache/gc.js
10:17:02 PM [vite] page reload $houdini/runtime/cache/cache.js
10:17:02 PM [vite] page reload $houdini/runtime/cache/index.js
10:17:02 PM [vite] page reload $houdini/runtime/cache/lists.js
10:17:02 PM [vite] page reload $houdini/runtime/cache/staleManager.js
10:17:02 PM [vite] page reload $houdini/runtime/cache/stuff.js
10:17:02 PM [vite] page reload $houdini/runtime/cache/subscription.js
10:17:02 PM [vite] page reload $houdini/runtime/cache/storage.js
10:17:02 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/base.js
10:17:02 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/index.js
10:17:02 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/mutation.js
10:17:02 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/query.js
10:17:02 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/subscription.js
10:17:02 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/fragment.js
10:17:02 PM [vite] page reload $houdini/runtime/client/plugins/cache.js
10:17:02 PM [vite] page reload $houdini/runtime/client/plugins/fetch.js
10:17:02 PM [vite] page reload $houdini/runtime/client/plugins/fetchParams.js
10:17:02 PM [vite] page reload $houdini/runtime/client/plugins/fragment.js
10:17:02 PM [vite] page reload $houdini/runtime/client/plugins/mutation.js
10:17:02 PM [vite] page reload $houdini/runtime/client/plugins/index.js
10:17:02 PM [vite] page reload $houdini/runtime/client/plugins/query.js
10:17:02 PM [vite] page reload $houdini/runtime/client/plugins/optimisticKeys.js
10:17:02 PM [vite] page reload $houdini/runtime/client/plugins/subscription.js
10:17:02 PM [vite] page reload $houdini/runtime/client/plugins/throwOnError.js
10:17:02 PM [vite] page reload $houdini/runtime/client/utils/documentPlugins.js
10:17:02 PM [vite] page reload $houdini/runtime/client/utils/index.js
10:17:02 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/pagination/index.js
10:17:02 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/pagination/fragment.js
10:17:02 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/pagination/query.js
10:17:02 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/types.js
10:17:02 PM [vite] page reload $houdini/runtime/router/types.js
10:17:02 PM [vite] page reload $houdini/runtime/index.js
10:17:03 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/fragments.js
10:17:03 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/index.js
10:17:03 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/session.js
10:17:03 PM [vite] page reload $houdini/runtime/cache/cache.js
10:17:03 PM [vite] page reload $houdini/runtime/cache/gc.js
10:17:03 PM [vite] page reload $houdini/runtime/cache/index.js
10:17:03 PM [vite] page reload $houdini/runtime/cache/storage.js
10:17:03 PM [vite] page reload $houdini/runtime/cache/stuff.js
10:17:03 PM [vite] page reload $houdini/runtime/cache/staleManager.js
10:17:03 PM [vite] page reload $houdini/runtime/cache/lists.js
10:17:03 PM [vite] page reload $houdini/runtime/cache/subscription.js
10:17:03 PM [vite] page reload $houdini/runtime/client/documentStore.js
10:17:03 PM [vite] page reload $houdini/runtime/client/index.js
10:17:03 PM [vite] page reload $houdini/runtime/lib/config.js
10:17:03 PM [vite] page reload $houdini/runtime/lib/deepEquals.js
10:17:03 PM [vite] page reload $houdini/runtime/lib/flatten.js
10:17:03 PM [vite] page reload $houdini/runtime/lib/key.js
10:17:03 PM [vite] page reload $houdini/runtime/lib/log.js
10:17:03 PM [vite] page reload $houdini/runtime/lib/lru.js
10:17:03 PM [vite] page reload $houdini/runtime/lib/pageInfo.js
10:17:03 PM [vite] page reload $houdini/runtime/lib/index.js
10:17:03 PM [vite] page reload $houdini/runtime/lib/scalars.js
10:17:03 PM [vite] page reload $houdini/runtime/lib/pagination.js
10:17:03 PM [vite] page reload $houdini/runtime/lib/store.js
10:17:03 PM [vite] page reload $houdini/runtime/lib/types.js
10:17:03 PM [vite] page reload $houdini/runtime/public/cache.js
10:17:03 PM [vite] page reload $houdini/runtime/public/index.js
10:17:03 PM [vite] page reload $houdini/runtime/lib/selection.js
10:17:03 PM [vite] page reload $houdini/runtime/public/record.js
10:17:03 PM [vite] page reload $houdini/runtime/public/list.js
10:17:03 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/base.js
10:17:03 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/fragment.js
10:17:03 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/mutation.js
10:17:03 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/index.js
10:17:03 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/query.js
10:17:03 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/subscription.js
10:17:03 PM [vite] page reload $houdini/runtime/client/utils/documentPlugins.js
10:17:03 PM [vite] page reload $houdini/runtime/client/utils/index.js
10:17:03 PM [vite] page reload $houdini/runtime/client/plugins/cache.js
10:17:03 PM [vite] page reload $houdini/runtime/client/plugins/fragment.js
10:17:03 PM [vite] page reload $houdini/runtime/client/plugins/fetch.js
10:17:03 PM [vite] page reload $houdini/runtime/client/plugins/index.js
10:17:03 PM [vite] page reload $houdini/runtime/client/plugins/fetchParams.js
10:17:03 PM [vite] page reload $houdini/runtime/client/plugins/mutation.js
10:17:03 PM [vite] page reload $houdini/runtime/client/plugins/optimisticKeys.js
10:17:03 PM [vite] page reload $houdini/runtime/client/plugins/query.js
10:17:03 PM [vite] page reload $houdini/runtime/client/plugins/subscription.js
10:17:03 PM [vite] page reload $houdini/runtime/client/plugins/throwOnError.js
10:17:03 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/pagination/fragment.js
10:17:03 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/pagination/index.js
10:17:03 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/pagination/query.js
10:17:03 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/types.js
10:17:03 PM [vite] page reload $houdini/runtime/router/types.js
10:18:21 PM [vite] page reload src/routes/api/acuity/webhook/+server.ts
10:18:22 PM [vite] page reload $houdini/runtime/index.js
10:18:22 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/fragments.js
10:18:22 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/index.js
10:18:22 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/session.js
10:18:22 PM [vite] page reload $houdini/runtime/client/index.js
10:18:22 PM [vite] page reload $houdini/runtime/client/documentStore.js
10:18:22 PM [vite] page reload $houdini/runtime/public/cache.js
10:18:22 PM [vite] page reload $houdini/runtime/public/index.js
10:18:22 PM [vite] page reload $houdini/runtime/public/list.js
10:18:22 PM [vite] page reload $houdini/runtime/public/record.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/config.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/deepEquals.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/flatten.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/index.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/lru.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/log.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/pageInfo.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/scalars.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/pagination.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/selection.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/store.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/types.js
10:18:22 PM [vite] page reload $houdini/runtime/cache/cache.js
10:18:22 PM [vite] page reload $houdini/runtime/cache/index.js
10:18:22 PM [vite] page reload $houdini/runtime/cache/gc.js
10:18:22 PM [vite] page reload $houdini/runtime/cache/lists.js
10:18:22 PM [vite] page reload $houdini/runtime/cache/stuff.js
10:18:22 PM [vite] page reload $houdini/runtime/cache/storage.js
10:18:22 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/base.js
10:18:22 PM [vite] page reload $houdini/runtime/cache/staleManager.js
10:18:22 PM [vite] page reload $houdini/runtime/cache/subscription.js
10:18:22 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/fragment.js
10:18:22 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/index.js
10:18:22 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/mutation.js
10:18:22 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/query.js
10:18:22 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/subscription.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/key.js
10:18:22 PM [vite] page reload $houdini/runtime/client/utils/documentPlugins.js
10:18:22 PM [vite] page reload $houdini/runtime/client/plugins/cache.js
10:18:22 PM [vite] page reload $houdini/runtime/client/utils/index.js
10:18:22 PM [vite] page reload $houdini/runtime/client/plugins/fetch.js
10:18:22 PM [vite] page reload $houdini/runtime/client/plugins/fetchParams.js
10:18:22 PM [vite] page reload $houdini/runtime/client/plugins/fragment.js
10:18:22 PM [vite] page reload $houdini/runtime/client/plugins/index.js
10:18:22 PM [vite] page reload $houdini/runtime/client/plugins/mutation.js
10:18:22 PM [vite] page reload $houdini/runtime/client/plugins/query.js
10:18:22 PM [vite] page reload $houdini/runtime/client/plugins/optimisticKeys.js
10:18:22 PM [vite] page reload $houdini/runtime/client/plugins/subscription.js
10:18:22 PM [vite] page reload $houdini/runtime/client/plugins/throwOnError.js
10:18:22 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/pagination/fragment.js
10:18:22 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/pagination/index.js
10:18:22 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/pagination/query.js
10:18:22 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/types.js
10:18:22 PM [vite] page reload $houdini/runtime/router/types.js
10:18:22 PM [vite] page reload $houdini/runtime/index.js
10:18:22 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/fragments.js
10:18:22 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/index.js
10:18:22 PM [vite] page reload $houdini/runtime/cache/cache.js
10:18:22 PM [vite] page reload $houdini/runtime/cache/gc.js
10:18:22 PM [vite] page reload $houdini/runtime/cache/index.js
10:18:22 PM [vite] page reload $houdini/runtime/cache/lists.js
10:18:22 PM [vite] page reload $houdini/runtime/cache/staleManager.js
10:18:22 PM [vite] page reload $houdini/runtime/cache/stuff.js
10:18:22 PM [vite] page reload $houdini/runtime/cache/storage.js
10:18:22 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/session.js
10:18:22 PM [vite] page reload $houdini/runtime/client/documentStore.js
10:18:22 PM [vite] page reload $houdini/runtime/client/index.js
10:18:22 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/types.js
10:18:22 PM [vite] page reload $houdini/runtime/cache/subscription.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/config.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/deepEquals.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/flatten.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/index.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/key.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/log.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/lru.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/pageInfo.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/pagination.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/scalars.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/selection.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/store.js
10:18:22 PM [vite] page reload $houdini/runtime/lib/types.js
10:18:22 PM [vite] page reload $houdini/runtime/public/cache.js
10:18:22 PM [vite] page reload $houdini/runtime/public/index.js
10:18:22 PM [vite] page reload $houdini/runtime/public/record.js
10:18:22 PM [vite] page reload $houdini/runtime/public/list.js
10:18:23 PM [vite] page reload $houdini/runtime/router/types.js
10:18:23 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/base.js
10:18:23 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/fragment.js
10:18:23 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/index.js
10:18:23 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/mutation.js
10:18:23 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/query.js
10:18:23 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/subscription.js
10:18:23 PM [vite] page reload $houdini/runtime/client/plugins/cache.js
10:18:23 PM [vite] page reload $houdini/runtime/client/plugins/fetch.js
10:18:23 PM [vite] page reload $houdini/runtime/client/plugins/fetchParams.js
10:18:23 PM [vite] page reload $houdini/runtime/client/plugins/fragment.js
10:18:23 PM [vite] page reload $houdini/runtime/client/plugins/index.js
10:18:23 PM [vite] page reload $houdini/runtime/client/plugins/mutation.js
10:18:23 PM [vite] page reload $houdini/runtime/client/plugins/optimisticKeys.js
10:18:23 PM [vite] page reload $houdini/runtime/client/plugins/query.js
10:18:23 PM [vite] page reload $houdini/runtime/client/plugins/subscription.js
10:18:23 PM [vite] page reload $houdini/runtime/client/utils/documentPlugins.js
10:18:23 PM [vite] page reload $houdini/runtime/client/utils/index.js
10:18:23 PM [vite] page reload $houdini/runtime/client/plugins/throwOnError.js
10:18:23 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/pagination/fragment.js
10:18:23 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/pagination/index.js
10:18:23 PM [vite] page reload $houdini/plugins/houdini-svelte/runtime/stores/pagination/query.js
10:18:23 PM [vite] Error when evaluating SSR module /$houdini/runtime/cache/lists.js: failed to import "/$houdini/runtime/cache/cache.js"
|- Error: [vite] The dependency module is not yet fully initialized due to circular dependency. This is a bug in Vite SSR
    at ssrImport (file:///Users/francis/project/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52599:19)
    at eval (/Users/francis/project/$houdini/runtime/cache/lists.js:4:37)
    at async instantiateModule (file:///Users/francis/project/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52650:5)

10:18:23 PM [vite] Error when evaluating SSR module /$houdini/runtime/cache/cache.js: failed to import "/$houdini/runtime/cache/cache.js"
|- Error: [vite] The dependency module is not yet fully initialized due to circular dependency. This is a bug in Vite SSR
    at ssrImport (file:///Users/francis/project/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52599:19)
    at eval (/Users/francis/project/$houdini/runtime/cache/lists.js:4:37)
    at async instantiateModule (file:///Users/francis/project/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52650:5)

10:18:23 PM [vite] Error when evaluating SSR module /$houdini/runtime/cache/index.js: failed to import "/$houdini/runtime/cache/cache.js"
|- Error: [vite] The dependency module is not yet fully initialized due to circular dependency. This is a bug in Vite SSR
    at ssrImport (file:///Users/francis/project/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52599:19)
    at eval (/Users/francis/project/$houdini/runtime/cache/lists.js:4:37)
    at async instantiateModule (file:///Users/francis/project/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52650:5)

10:18:23 PM [vite] Error when evaluating SSR module /$houdini/runtime/client/index.js: failed to import "/$houdini/runtime/cache/cache.js"
|- Error: [vite] The dependency module is not yet fully initialized due to circular dependency. This is a bug in Vite SSR
    at ssrImport (file:///Users/francis/project/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52599:19)
    at eval (/Users/francis/project/$houdini/runtime/cache/lists.js:4:37)
    at async instantiateModule (file:///Users/francis/project/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52650:5)

10:18:23 PM [vite] Error when evaluating SSR module /$houdini/index.js: failed to import "/$houdini/runtime/cache/cache.js"
|- Error: [vite] The dependency module is not yet fully initialized due to circular dependency. This is a bug in Vite SSR
    at ssrImport (file:///Users/francis/project/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52599:19)
    at eval (/Users/francis/project/$houdini/runtime/cache/lists.js:4:37)
    at async instantiateModule (file:///Users/francis/project/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52650:5)

10:18:23 PM [vite] Error when evaluating SSR module /src/hooks.server.ts: failed to import "/$houdini/runtime/cache/cache.js"
|- Error: [vite] The dependency module is not yet fully initialized due to circular dependency. This is a bug in Vite SSR
    at ssrImport (file:///Users/francis/project/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52599:19)
    at eval (/Users/francis/project/$houdini/runtime/cache/lists.js:4:37)
    at async instantiateModule (file:///Users/francis/project/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52650:5)

10:18:23 PM [vite] Error when evaluating SSR module /src/routes/+layout.ts: failed to import "/$houdini/runtime/cache/cache.js"
|- Error: [vite] The dependency module is not yet fully initialized due to circular dependency. This is a bug in Vite SSR
    at ssrImport (file:///Users/francis/project/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52599:19)
    at eval (/Users/francis/project/$houdini/runtime/cache/lists.js:4:37)
    at async instantiateModule (file:///Users/francis/project/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52650:5)
AlecAivazis commented 3 months ago

@fnimick looking through your logs, i think the culprit is that first cycle that @shadow-identity called out. I pushed up a branch that removes it - mind seeing if that was enough to fix your issue? The branch name is circular-imports

ryanbmarx commented 3 months ago

Gonna 👀 this. I'm seeing similar behavior on latest version (1.2.54).


✖ Found 4 circular dependencies!

1) $houdini/runtime/cache/cache.js > $houdini/runtime/cache/lists.js
2) $houdini/runtime/cache/cache.js > $houdini/runtime/cache/subscription.js
3) $houdini/runtime/cache/cache.d.ts > $houdini/runtime/cache/subscription.d.ts
4) .svelte-kit/output/server/chunks/query.js > .svelte-kit/output/server/chunks/client.js```
AlecAivazis commented 3 months ago

that circle should be fixed in the branch. Let me open a PR with just that fix

shadow-identity commented 3 months ago

Thanks for the fix!

The first two error messages don't appear anymore, but the last four (from $houdini/index.js) are still here. I updated the reproduction repository with the updated houdini and houdini-svelte dependencies.

Should we reopen the ticket or create a new one?

  $houdini/index.js
        $houdini/index.js -> $houdini/plugins/houdini-svelte/runtime/client.js -> $houdini/plugins/houdini-svelte/runtime/stores/mutation.js -> $houdini/plugins/houdini-svelte/stores/AddItem.js -> $houdini/plugins/houdini-svelte/stores/index.js -> src/client.ts
        $houdini/index.js -> $houdini/plugins/houdini-svelte/runtime/client.js -> $houdini/plugins/houdini-svelte/runtime/stores/pagination/query.js -> $houdini/plugins/houdini-svelte/stores/AllItems.js -> $houdini/plugins/houdini-svelte/stores/index.js -> src/client.ts
        $houdini/index.js -> $houdini/plugins/houdini-svelte/runtime/client.js -> $houdini/plugins/houdini-svelte/runtime/index.js -> $houdini/plugins/houdini-svelte/runtime/stores/index.js -> $houdini/plugins/houdini-svelte/runtime/stores/pagination/fragment.js -> $houdini/plugins/houdini-svelte/runtime/stores/pagination/index.js -> src/client.ts
        $houdini/index.js -> $houdini/plugins/houdini-svelte/runtime/client.js -> $houdini/plugins/houdini-svelte/runtime/index.js -> $houdini/plugins/houdini-svelte/runtime/stores/index.js -> $houdini/plugins/houdini-svelte/runtime/stores/pagination/index.js -> $houdini/plugins/houdini-svelte/runtime/stores/pagination/query.js -> src/client.ts
fnimick commented 3 months ago

For some reason, even without updating houdini, I haven't run into circular imports in a while. Unfortunately I am not able to reliably duplicate the issue - it tends to happen after my dev server has been running and doing hot reloads and rebuilds for hours.

AlecAivazis commented 3 months ago

Thanks for the update @fnimick. I'm gonna leave this issue open to address them anyway, just to be sure.