mongoose-zod
mongoose-zod copied to clipboard
Code TS error on node 18
I want to thank you for this great work; I ran into trouble using this code.
I used ts-node-dev
and tried configuring my tsconfig and adding ESM support - output failed.
ts-node-dev --loader ts-node/esm --no-warnings --inspect=0.0.0.0:9229 --project ./tsconfig.json --respawn --rs false --exit-child --watch ./src -- ./src/index.ts
my tsconfig
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Language and Environment */
"target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"paths": {
"@/package/*": [
"./../*"
], /* alias for vscode, see {@link} packages/api/src/aliases.ts for alias ts-node */
"@/lib/*": [
"./../../lib/*"
], /* alias for vscode, see {@link} packages/api/src/aliases.ts for alias ts-node */
},
/* Modules */
"module": "Node16", /* Specify what module code is generated. */
"typeRoots": [
"./node_modules/@types",
"./@types"
], /* Specify multiple folders that act like './node_modules/@types'. */
"types": [
"node",
"express"
], /* Specify type package names to be included without being referenced in a source file. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"jsx": "react" /* allow to use other packages tsx|jsx */
}
}
My environment doesn't like `import.meta'
// const mlvPlugin = tryImportModule('mongoose-lean-virtuals', import.meta);
// const mldPlugin = tryImportModule('mongoose-lean-defaults', import.meta);
// const mlgPlugin = tryImportModule('mongoose-lean-getters', import.meta);
import mlvPlugin from 'mongoose-lean-virtuals';
import mldPlugin from 'mongoose-lean-defaults';
import mlgPlugin from 'mongoose-lean-getters';
Changing the code in to-monggose
, and not sure what it does by disabling it