magicseth
magicseth•3y ago

'"convex/schema"' has no exported member 'defineSchema'

I'm seeing this with a new vue project
convex/schema.ts:1:10 - error TS2614: Module '"convex/schema"' has no exported member 'defineSchema'. Did you mean to use 'import defineSchema from "convex/schema"' instead?
convex/schema.ts:1:10 - error TS2614: Module '"convex/schema"' has no exported member 'defineSchema'. Did you mean to use 'import defineSchema from "convex/schema"' instead?
Any thoughts?
15 Replies
sshader
sshader•3y ago
Somewhat of a guess, but do you have a tsconfig somewhere with baseUrl: "." ? There were some similar sounding issues where the compiler / build system would confuse the convex/schema.ts file with the convex/schema npm package. The other thing to try to see if this could be the issue would be renaming your convex directory (but this is fairly annoying)
magicseth
magicsethOP•3y ago
I do have baseUrl getting rid of That fixed
sshader
sshader•3y ago
Removing the baseUrl: "." should hopefully fix this issue, but could potentially break other imports in your project. Did you create this project from npm init vue@latest or a similar template? Would love to see what the template is doing and hopefully try and avoid this issue for future Vue projects
magicseth
magicsethOP•3y ago
I used this:npm create vue@3 yarn build is still complaining about moret hings
convex/actions/speechTokens.ts:10:15 - error TS2591: Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig.

10 const key = process.env.MICROSOFT_SPEECH_KEY;
convex/actions/speechTokens.ts:10:15 - error TS2591: Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig.

10 const key = process.env.MICROSOFT_SPEECH_KEY;
It's confusing to me as to why build is touching things in convex/ directory
ballingt
ballingt•3y ago
When you run TypeScript on client code it follows the types if that code ever imports from convex/_generated/api.d.ts you probably do want to install those node types to use process in Convex functions
magicseth
magicsethOP•3y ago
Convex seems to have no problem I have installed those types Here is my main tsconfig:
magicseth
magicsethOP•3y ago
No description
magicseth
magicsethOP•3y ago
ahh it's not in the compiler options The typescript error could be better:
and then add 'node' to the types field in your tsconfig.
and then add 'node' to the types field in your tsconfig.
they could specify compilerOptions ;-/ Thanks Tom
ballingt
ballingt•3y ago
I hope that deleting the "types" field altogether would also work
magicseth
magicsethOP•3y ago
I'm still struggling with typescript 😕 I can start another thread if you want, but I just started getting new errors:
Vite Error, /node_modules/.vite/deps/convex_values.js?v=2e5c21c6 optimized info should be defined
Vite Error, /node_modules/.vite/deps/convex_values.js?v=2e5c21c6 optimized info should be defined
and
✘ [ERROR] Could not resolve "./build/Release/re2"

node_modules/re2/re2.js:3:20:
3 │ const RE2 = require('./build/Release/re2');
╵ ~~~~~~~~~~~~~~~~~~~~~
✘ [ERROR] Could not resolve "./build/Release/re2"

node_modules/re2/re2.js:3:20:
3 │ const RE2 = require('./build/Release/re2');
╵ ~~~~~~~~~~~~~~~~~~~~~
When I tried to import { Id } Okay it's when I try to call new Id("users", userid) Is there a generally accepted way to deal with returning javascript objects that have hyphens in their keys? I'm having to serialize my nice object to JSON, and rehydrate it in the browser
sshader
sshader•3y ago
Good question! Going to answer momentarily in https://discord.com/channels/1019350475847499849/1088907682125185136
magicseth
magicsethOP•3y ago
I'm still having trouble using Id<> in my client code This is still happening
magicseth
magicsethOP•3y ago
No description
ballingt
ballingt•3y ago
sounds like https://github.com/uhop/node-re2/issues/92, is this library being used in a Convex function?
GitHub
Issues · uhop/node-re2
node.js bindings for RE2: fast, safe alternative to backtracking regular expression engines. - Issues · uhop/node-re2
ballingt
ballingt•3y ago
Curious to see the Id thing, where is Id being imported from and what does it look like when hovered? Looks like some libraries have made re2 optional to work around this, what's the explicit dependency that is pulling re2 in transitively?

Did you find this page helpful?