Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/graphql/lib/plugin/visitors/model-class.visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export class ModelClassVisitor {
const metadataWithImports = [];
Object.keys(this._collectedMetadata).forEach((filePath) => {
const metadata = this._collectedMetadata[filePath];
const path = filePath.replace(/\.[jt]s$/, '');
// Emit explicit .js specifiers so generated metadata.ts stays NodeNext-compatible.
const path = filePath.replace(/\.[jt]s$/, '.js');
const importExpr = ts.factory.createCallExpression(
ts.factory.createToken(ts.SyntaxKind.ImportKeyword) as ts.Expression,
undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default async () => {
'@nestjs/graphql': {
models: [
[
import('./recipes/dto/new-recipe.input'),
import('./recipes/dto/new-recipe.input.js'),
{
NewRecipeInput: {
title: {
Expand All @@ -22,7 +22,7 @@ export default async () => {
}
],
[
import('./recipes/dto/recipes.args'),
import('./recipes/dto/recipes.args.js'),
{
RecipesArgs: {
skip: { type: () => Number },
Expand All @@ -31,7 +31,7 @@ export default async () => {
}
],
[
import('./recipes/models/ingredient.model'),
import('./recipes/models/ingredient.model.js'),
{
Ingredient: {
id: { type: () => String },
Expand All @@ -40,7 +40,7 @@ export default async () => {
}
],
[
import('./recipes/models/recipe.model'),
import('./recipes/models/recipe.model.js'),
{
Recipe: {
id: { type: () => String },
Expand Down