{"record":{"id":"ee48a15ddcd5757c","repo":"emotion-js/emotion","slug":"you-have-specified-that-importsource-re-expor","errorCode":null,"errorMessage":"You have specified that '${importSource}' re-exports '${reexported}' from '@emotion/react' but it doesn't also re-export 'css' from '@emotion/react', 'css' is necessary for certain optimisations, please re-export it from '${importSource}'","messagePattern":"You have specified that '(.+?)' re-exports '(.+?)' from '@emotion/react' but it doesn't also re-export 'css' from '@emotion/react', 'css' is necessary for certain optimisations, please re-export it from '(.+?)'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/babel-plugin/src/index.js","lineNumber":20,"sourceCode":"  createEmotionMacro,\n  transformers as vanillaTransformers\n} from './emotion-macro'\nimport { createStyledMacro, styledTransformer } from './styled-macro'\nimport coreMacro, {\n  transformers as coreTransformers,\n  transformCsslessArrayExpression,\n  transformCsslessObjectExpression\n} from './core-macro'\nimport { getStyledOptions, createTransformerMacro } from './utils'\n\nconst getCssExport = (reexported, importSource, mapping) => {\n  const cssExport = Object.keys(mapping).find(localExportName => {\n    const [packageName, exportName] = mapping[localExportName].canonicalImport\n    return packageName === '@emotion/react' && exportName === 'css'\n  })\n\n  if (!cssExport) {\n    throw new Error(\n      `You have specified that '${importSource}' re-exports '${reexported}' from '@emotion/react' but it doesn't also re-export 'css' from '@emotion/react', 'css' is necessary for certain optimisations, please re-export it from '${importSource}'`\n    )\n  }\n\n  return cssExport\n}\n\nlet webStyledMacro = createStyledMacro({\n  importSource: '@emotion/styled/base',\n  originalImportSource: '@emotion/styled',\n  isWeb: true\n})\nlet nativeStyledMacro = createStyledMacro({\n  importSource: '@emotion/native',\n  originalImportSource: '@emotion/native',\n  isWeb: false\n})\nlet primitivesStyledMacro = createStyledMacro({","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/emotion-js/emotion/blob/b882bcba85132554992e4bd49e94c95939bbf810/packages/babel-plugin/src/index.js#L2-L38","documentation":"When you configure @emotion/babel-plugin's `importMap` to point at a module that re-exports `jsx` (or other @emotion/react exports), that module must also re-export `css` from @emotion/react. The `css` export is required for label/optimization rewriting, so the plugin validates it when building the export mapping and throws if absent.","triggerScenarios":"Passing an `importMap` entry like { './my-emotion': { jsx: { canonicalImport: ['@emotion/react','jsx'] } } } where the module re-exports jsx but not css from @emotion/react.","commonSituations":"Creating a custom barrel module that cherry-picks exports, or upgrading the emotion babel plugin after adding an importMap that predates the css requirement.","solutions":["Add `export { css } from '@emotion/react'` to the module listed in your importMap","Add a css entry to the importMap mapping (e.g. css: { canonicalImport: ['@emotion/react','css'] }) if it's already exported under a different name","Remove the importMap entry if you don't need a custom re-export module"],"exampleFix":"// before (my-emotion.ts)\nexport { jsx } from '@emotion/react'\n// after\nexport { jsx, css } from '@emotion/react'","handlingStrategy":"validation","validationCode":"// in the re-export module, before using it as an importMap target\nexport { jsx, css } from '@emotion/react';\n// sanity check in a test:\nimport * as m from './my-emotion';\nif (!m.css) throw new Error('importMap target must re-export css from @emotion/react');","typeGuard":"const exportsCss = (mod) => typeof mod === 'object' && mod !== null && typeof mod.css === 'function';","tryCatchPattern":null,"preventionTips":["When creating emotion re-export barrels, always re-export css alongside jsx","Test importMap targets with a unit test asserting css is exported","Review importMap entries when upgrading the emotion babel plugin"],"tags":["babel","emotion","importmap","configuration"],"backgroundTag":"missing-reexport","analyzedSha":"b882bcba85132554992e4bd49e94c95939bbf810","analyzedAt":"2026-09-02T22:27:13.739Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}