{"record":{"id":"63eb08f3980b6d02","repo":"parcel-bundler/parcel","slug":"src-does-not-export-exportname","errorCode":null,"errorMessage":"\"${src}\" does not export \"${exportName}\".","messagePattern":"\"(.+?)\" does not export \"(.+?)\"\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/transformers/js/src/JSTransformer.js","lineNumber":493,"sourceCode":"      inline_constants: config.inlineConstants,\n      callMacro: asset.isSource\n        ? async (err, src, exportName, args, loc) => {\n            let mod;\n            try {\n              mod = await options.packageManager.require(src, asset.filePath);\n\n              // Default interop for CommonJS modules.\n              if (\n                exportName === 'default' &&\n                !mod.__esModule &&\n                // $FlowFixMe\n                Object.prototype.toString.call(config) !== '[object Module]'\n              ) {\n                mod = {default: mod};\n              }\n\n              if (!Object.hasOwnProperty.call(mod, exportName)) {\n                throw new Error(`\"${src}\" does not export \"${exportName}\".`);\n              }\n            } catch (err) {\n              throw {\n                kind: 1,\n                message: err.message,\n              };\n            }\n\n            try {\n              if (typeof mod[exportName] === 'function') {\n                let ctx: MacroContext = {\n                  // Allows macros to emit additional assets to add as dependencies (e.g. css).\n                  addAsset(a: MacroAsset) {\n                    let k =\n                      (asset.uniqueKey ? asset.uniqueKey + ':' : '') +\n                      String(macroAssets.length);\n                    let map;\n                    if (asset.env.sourceMap) {","sourceCodeStart":475,"sourceCodeEnd":511,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/transformers/js/src/JSTransformer.js#L475-L511","documentation":"Thrown from the SWC macro callback in JSTransformer when a macro import resolves to a module that does not expose the requested named export. After require() succeeds and CommonJS default interop is applied (if applicable), Object.hasOwnProperty.call(mod, exportName) is false. The error is caught and re-thrown as a `{kind: 1, message}` object that Rust-side SWC processing recognizes as a macro resolution failure.","triggerScenarios":"A `// @macro`-style call site references `import {foo} from 'pkg'` and calls it as a macro, but `pkg` does not export `foo`. Or the default export interop path does not apply and the named export is genuinely absent.","commonSituations":"Wrong macro name (e.g. calling `css` from a package that exports `cssMap`); package version change that renamed or removed an export; CommonJS interop mismatch where __esModule is not set but default re-wrapping is not triggered because the module looked like an ES module; cyclic import that has not finished evaluating.","solutions":["Open the macro-target package and confirm the named export exists (and its spelling).","For CommonJS modules, ensure you call a real named property; if you want the whole module use the `default` export name.","Pin or upgrade the macro package to the version whose exports you depend on.","If you authored the macro module, make sure it is ESM or sets __esModule correctly so interop behaves as expected."],"exampleFix":"// before\nimport {css} from 'my-macros';\n// my-macros only exports `cssMap`\nconst cls = css`...`;\n\n// after\nimport {cssMap as css} from 'my-macros';","handlingStrategy":"type-guard","validationCode":"async function macroExportsExist(specifier, exportName, fromPath) {\n  const mod = await import(specifier); // or require, depending on env\n  if (!(exportName in mod)) {\n    throw new Error(`macro ${specifier} does not export ${exportName}; available: ${Object.keys(mod).join(', ')}`);\n  }\n  return mod;\n}","typeGuard":"function hasExport(mod, name) {\n  return Object.prototype.hasOwnProperty.call(mod, name);\n}","tryCatchPattern":null,"preventionTips":["Pin macro package versions so renamed exports surface in a lockfile diff.","Author a thin wrapper module that re-exports only the macros you use, so call sites stay decoupled from upstream renames."],"tags":["macros","swc","named-export","interop"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}