{"record":{"id":"3692e92c05b65abc","repo":"remix-run/remix","slug":"files-globaltransforms-index-must-define-a-tra","errorCode":null,"errorMessage":"files.globalTransforms[${index}] must define a transform() function","messagePattern":"files\\.globalTransforms\\[(.+?)\\] must define a transform\\(\\) function","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/assets/src/lib/files/config.ts","lineNumber":278,"sourceCode":"\n  let normalizedGlobalTransforms: ResolvedAssetGlobalTransform[] = []\n\n  for (let [index, transform] of globalTransforms.entries()) {\n    if (typeof transform === 'function') {\n      normalizedGlobalTransforms.push({ transform })\n      continue\n    }\n\n    if (transform === null || typeof transform !== 'object') {\n      throw new TypeError(`files.globalTransforms[${index}] must be a function or object`)\n    }\n\n    if ('name' in transform && transform.name !== undefined && typeof transform.name !== 'string') {\n      throw new TypeError(`files.globalTransforms[${index}].name must be a string`)\n    }\n\n    if (typeof transform.transform !== 'function') {\n      throw new TypeError(`files.globalTransforms[${index}] must define a transform() function`)\n    }\n\n    normalizedGlobalTransforms.push({\n      ...transform,\n      extensions: normalizeTransformExtensions(\n        transform.extensions,\n        `files.globalTransforms[${index}].extensions`,\n      ),\n    })\n  }\n\n  let maxRequestTransforms = files.maxRequestTransforms ?? defaultMaxRequestTransforms\n  if (!Number.isInteger(maxRequestTransforms) || maxRequestTransforms < 1) {\n    throw new TypeError('files.maxRequestTransforms must be a positive integer')\n  }\n\n  if (files.cache !== undefined) {\n    if (","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/assets/src/lib/files/config.ts#L260-L296","documentation":"Object-form entries in `files.globalTransforms` must include a callable `transform` function — the code that performs the transformation. This error fires when the entry is an object but `transform` is missing or not a function.","triggerScenarios":"`globalTransforms: [{ extensions: ['.css'] }]` where `transform` was omitted, or where `transform` holds a non-function (e.g. a string reference or imported non-function export).","commonSituations":"Object entries that only set options like `extensions` and forget the function; importing a default vs named export incorrectly so `transform` receives a module object; typos like `transforms:` inside a global-transform object.","solutions":["Add the function: `{ transform: minifyCss, extensions: ['.css'] }`","Check the import: use `import { minifyCss }` vs `import minifyCss from` as appropriate so you get the function, not a module namespace"],"exampleFix":"// before\nfiles: { globalTransforms: [{ extensions: ['.css'] }] }\n// after\nfiles: { globalTransforms: [{ transform: minifyCss, extensions: ['.css'] }] }","handlingStrategy":"type-guard","validationCode":"files.globalTransforms?.forEach((t, i) => {\n  if (typeof t === 'object' && t !== null && typeof t.transform !== 'function') {\n    throw new Error(`globalTransforms[${i}] is missing transform()`)\n  }\n})","typeGuard":"function isGlobalTransformDef(t: unknown): t is { transform: (...args: unknown[]) => unknown; name?: string; extensions?: string[] } {\n  return !!t && typeof t === 'object' && typeof (t as any).transform === 'function'\n}","tryCatchPattern":null,"preventionTips":["Double-check named vs default imports for transform packages","Include transform: fn in every object-form entry; bare functions can skip the wrapper"],"tags":["config","files","transforms","validation"],"backgroundTag":"config-type-validation","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}