Open benrbowers opened 5 months ago
What does your tsconfig.json
look like for this project? You might need to set "moduleResolution": "bundler"
(see https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution-for-bundlers-typescript-runtimes-and-nodejs-loaders for more details).
We have an open issue to rehaul the TS output to take into account all of the new module resolution modes supported by both TypeScript, alternative runtimes (like Deno and Bun), and bundlers, but in the meantime we can figure out what the right incantation for your own particular setup should be.
Default tsconfig from create-remix@latest:
{
"include": [
"**/*.ts",
"**/*.tsx",
"**/.server/**/*.ts",
"**/.server/**/*.tsx",
"**/.client/**/*.ts",
"**/.client/**/*.tsx"
],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2022"],
"types": ["@remix-run/node", "vite/client"],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"module": "ESNext",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"target": "ES2022",
"strict": true,
"allowJs": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"paths": {
"~/*": ["./app/*"]
},
// Vite takes care of building everything, not tsc.
"noEmit": true
}
}
After moving from yarn to pnpm, this now works with no issues:
>> pnpm exec tsx seed/seed-citizens
pnpm: 9.6.0 edgedb version: 5.6+51fd5fe EdgeDB CLI: 5.2.2+270dbfa edgedb-js: 1.5.7 node: 20.12.2
😅
I still plan on doing a "target" update here to allow building node16
style module imports, but we do not have any progress to report on that yet.
Code
Error or desired behavior
"Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/ben/democracy-app/node_modules/edgedb/dist/reflection/index' imported from /home/ben/democracy-app/dbschema/edgeql-js/set.ts Did you mean to import "edgedb/dist/reflection/index.js"?"
Manually changing all occurrences of
import from "edgedb/dist/reflection/index"
andimport from "edgedb/dist/primitives/buffer"
toimport from "edgedb/dist/reflection/index.js"
andimport from "edgedb/dist/primitives/buffer.js"
fixes the issue.Versions
edgedb-js
version: 1.5.5@edgedb/generate
version: 0.5.3