{"record":{"id":"b73b96274d773c51","repo":"parcel-bundler/parcel","slug":"plugin-pluginname-has-no-exports","errorCode":null,"errorMessage":"Plugin ${pluginName} has no exports.","messagePattern":"Plugin (.+?) has no exports\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/core/src/loadParcelPlugin.js","lineNumber":232,"sourceCode":"                codeHighlights: generateJSONCodeHighlights(pkgContents, [\n                  {\n                    key: '/engines/parcel',\n                  },\n                ]),\n              },\n            ],\n          },\n        });\n      }\n    }\n  }\n\n  let plugin = await options.packageManager.require(pluginName, resolveFrom, {\n    shouldAutoInstall: options.shouldAutoInstall,\n  });\n  plugin = plugin.default ? plugin.default : plugin;\n  if (!plugin) {\n    throw new Error(`Plugin ${pluginName} has no exports.`);\n  }\n  plugin = plugin[CONFIG];\n  if (!plugin) {\n    throw new Error(\n      `Plugin ${pluginName} is not a valid Parcel plugin, should export an instance of a Parcel plugin ex. \"export default new Reporter({ ... })\".`,\n    );\n  }\n  return {\n    plugin,\n    version: nullthrows(pkg).version,\n    resolveFrom: toProjectPath(options.projectRoot, resolveFrom),\n    range,\n  };\n}\n","sourceCodeStart":214,"sourceCodeEnd":247,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/core/core/src/loadParcelPlugin.js#L214-L247","documentation":"After requiring the plugin module, Parcel unwraps `default` if present and then checks truthiness. If the resolved export is falsy (empty module, `null`/`undefined` default, or a module that failed to assign exports), there is no plugin object to invoke and Parcel rejects it.","triggerScenarios":"The required plugin module exports nothing (or a falsy default export).","commonSituations":"Plugin build emitted an empty bundle; plugin's main entry points at the wrong file; plugin authored with named exports only and no default.","solutions":["Ensure the plugin module has a default export that is a Parcel plugin instance.","Check the plugin's `main`/`exports` field in package.json resolves to the right file.","Rebuild/republish the plugin if its dist artifact is empty."],"exampleFix":"// before\nexport const transform = () => {}; // no default\n\n// after\nimport {Transformer} from '@parcel/plugin';\nexport default new Transformer({ async transform({asset}) { return [asset]; } });","handlingStrategy":"type-guard","validationCode":"// After requiring the plugin, assert a truthy export exists.\nconst mod = await require(name);\nconst exp = mod.default ?? mod;\nif (!exp) throw new Error(`${name} has no default export`);","typeGuard":"function hasTruthyExport(mod: any): boolean {\n  const exp = mod?.default ?? mod;\n  return Boolean(exp);\n}","tryCatchPattern":null,"preventionTips":["Always `export default new Reporter({...})` in plugins.","Verify the package.json `main`/`exports` field after building the plugin.","Smoke-test the plugin's default export in CI."],"tags":["plugin","exports","authoring"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}