{"record":{"id":"93f427ab2c714fda","repo":"remix-run/remix","slug":"errors-map-error-error-message-join-n","errorCode":null,"errorMessage":"${errors.map((error) => error.message).join('\\n')}","messagePattern":"\\$\\{errors\\.map\\(\\(error\\) => error\\.message\\)\\.join\\('\\\\n'\\)\\}","errorType":"exception","errorClass":"SyntaxError","httpStatus":null,"severity":"error","filePath":"packages/node-tsx/src/lib/transform.ts","lineNumber":36,"sourceCode":"  [key in TsconfigTransformCompilerOptionKey]?: string\n}\n\ntype TsconfigTransformCompilerOptionsIssue = {\n  key: TsconfigTransformCompilerOptionKey\n  value: unknown\n}\n\nexport function transformModule(filePath: string, source: string): string {\n  let compilerOptions = getTsconfigCompilerOptions(filePath)\n  let result = transformSync(filePath, source, {\n    lang: getLanguage(filePath),\n    sourceType: getSourceType(filePath, source),\n    sourcemap: true,\n    ...getJsxTransformOptions(filePath, compilerOptions),\n  })\n\n  if (result.errors.length > 0) {\n    throw createTransformError(result.errors)\n  }\n\n  if (result.map == null) {\n    return result.code\n  }\n\n  return `${result.code}\\n//# sourceMappingURL=data:application/json;base64,${Buffer.from(\n    JSON.stringify(result.map),\n  ).toString('base64')}`\n}\n\nfunction createTransformError(errors: OxcError[]): SyntaxError {\n  let message = errors.map((error) => error.message).join('\\n')\n  let error = new SyntaxError(message)\n  error.stack = errors.map(formatTransformError).join('\\n\\n')\n  return error\n}\n","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/node-tsx/src/lib/transform.ts#L18-L54","documentation":"transformModule runs esbuild-style transform (via the TS transform pipeline) on a module and checks `result.errors`. Any transform/parse diagnostics become a thrown error joining the diagnostic messages — i.e. your file has a syntax error the transform could not recover from.","triggerScenarios":"Importing a .ts/.tsx file (through Remix node-tsx loading) that contains a syntax error or unsupported syntax for the configured transform, producing nonzero `result.errors`.","commonSituations":"Syntax errors in TypeScript/JSX files loaded at runtime by node-tsx; unsupported syntax for the configured target/JSX factory; files with mismatched extensions.","solutions":["Fix the syntax error at the file/position given in the joined messages","Run `npx tsc --noEmit` or your linter to surface the syntax problem","Check the file's JSX/TSX settings match your tsconfig"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"import { runTsc } from './typecheck.ts'\nconst diagnostics = await runTsc(filePath)\nif (diagnostics.length > 0) throw new Error('Fix syntax errors before loading')","typeGuard":"const hasTransformDiagnostics = (result: { errors: unknown[] }): boolean =>\n  result.errors.length > 0","tryCatchPattern":"catch (error) {\n  if (error instanceof Error && /Transform failed|error/i.test(error.message)) {\n    // surface the per-file syntax diagnostics to the user\n  }\n  throw error\n}","preventionTips":["Type-check before running dev/server on TypeScript entry files","Keep a lint/typecheck step in CI to catch syntax errors before runtime transforms"],"tags":["typescript","transform","syntax-error"],"backgroundTag":"typescript-compile-error","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}