-
Notifications
You must be signed in to change notification settings - Fork 18
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
Cannot find module 'sqlocal/drizzle' or its corresponding type declarations.ts(2307) #1
Comments
Hi there! It would be helpful if you could describe in more detail what issue you are having and provide some information about your environment's setup. In this case, the most relevant information would probably be your package.json file and your TypeScript configuration. Ideally, you could provide a minimal reproduction. As an example, I just put together a minimal "hello world" app for using SQLocal with Drizzle here: https://github.com/DallasHoff/sqlocal-drizzle-hello-world |
i don't have the problem with the hello-world project. it's an issue with |
Ah, I see. Can I ask why you use "moduleResolution": "node"? The TypeScript docs say it's for "Node.js versions older than v10, which only support CommonJS require. You probably won’t need to use node10 in modern code." SQLocal is for the browser, not Node, and as far as I know, "moduleResolution": "node" does not support sub-module resolution for ES modules. Is there a requirement you have to use "node"? @reslear Are you also using "moduleResolution": "node"? |
When I make the change in tsconfig to "bundler". I no longer get syntax error; now I get during runtime:
I created a simple project to figure the issue - can you please see what I might be missing here: https://github.com/proof-llc/sqlocal-kysely-hello-world UPDATE: my bad, I forgot to import onMount only. It appears to work when I switch to "bundler". |
@DallasHoff I apologize I had to switch from Vue vite to nuxt vite and I won't be able to reproduce the error anymore. I'll check on nuxt soon. I suggest using the |
@reslear Could you tell me what you have the "moduleResolution" option set to in your tsconfig.json? |
@DallasHoff |
And you are still having the module resolution issue with it set to "bundler"? |
As I recalled it was then, I can't verify it now. |
What do you mean by you can't verify it? I just need to know if you get the module resolution error that you originally reported while the "moduleResolution" option is set to "bundler". You shouldn't. That error should only happen if you use a legacy option like "node". |
Closing. This issue can be fixed by making sure your TypeScript configuration's |
Obviously this is completely up to you to decide, but forcing the |
Of course it would be ideal if the library worked with all possible |
Yep, understood. I think an okay workaround, if someone can't use a more modern module resolution value, is to add something like the following to the "paths": {
"sqlocal/*": ["../node_modules/sqlocal/dist/*"]
} Where the path to the node module is relative to the |
maybe need to migrate https://github.com/egoist/tsup to better generate js mjs d.ts
The text was updated successfully, but these errors were encountered: