question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing server build import files: Cannot find module '#gql/default' or its corresponding type declarations

See original GitHub issue

Environment

  • Operating System: Linux
  • Node Version: v16.18.1
  • Nuxt Version: 3.0.0
  • Nitro Version: 1.0.0
  • Package Manager: yarn@1.22.19
  • Builder: vite
  • User Config: alias, experimental, build, app, sourcemap, dir, typescript, modules, vite, runtimeConfig
  • Runtime Modules: (), @pinia/nuxt@0.4.3, nuxt-graphql-client@0.2.12, @vueuse/nuxt@9.5.0
  • Build Modules: -

Describe the bug

I’ve upgraded to Nuxt v3 stable and latest version of lib and updated all imports to #gql. Now it can’t build

Works fine in nuxt dev, fails in nuxt build

Expected behaviour

Project builds

Reproduction

No response

Additional context

runtimeConfig: {
        public: {
            'graphql-client': {
                codegen: {
                    onlyOperationTypes: false,
                },
            },
        },
    },

Logs

ℹ Client built in 11342ms
ℹ Building server...
✔ Server built in 8706ms
✔ Generated public .output/public
ℹ Building Nitro Server (preset: node-server)
src/components/views/catalog/CatalogCardPresentation.vue(27,28): error TS2307: Cannot find module '#gql/default' or its corresponding type declarations.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Diizzayycommented, Nov 22, 2022

And now it’s working!

@daniluk4000 Perfect! Though It’s strange that the sub alias for #gql isn’t added in the production build, I may have to add it explicitly to prevent others from encountering this.

P.S. Reading your code was a pleasure, the job you’ve done is incredible.

Thank You! Happy to see that you’ve been enjoying this module. Much more great features are on the way.

1reaction
Diizzayycommented, Nov 22, 2022

@daniluk4000 Apologies for the late reply here, I’ve attempted to recreate this locally to no avail. Would you be willing to create a basic reproduction of this issue or give me access to the private repo for this project? I’d like to have a closer look to pinpoint the cause here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript: import fail: Cannot find module 'query.gql' #59
Try adding type declaration DocumentNode from graphql typings. // index.d.ts import { DocumentNode } from 'graphql' ...
Read more >
Cannot find module 'react' or its corresponding type ...
The editor throws errors while importing every installed library like this: Cannot find module 'react' or its corresponding type declarations. The project ...
Read more >
How to import my own module from a test file? - Reddit
I'm working on a node package but can't seem to figure out how to import said package ... or its corresponding type declarations.ts...
Read more >
Fix Global Installs Not Working | "Cannot find module" error FIX
Getting " Cannot find module " after installing something globally (with -g)? Well, this video shows you how to fix global package/module ...
Read more >
aguscha333 - RedwoodJS Community
Hi, I got to the deployment point of the blog tutorial and I am trying to deploy to Netlify with a mysql db...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found