Skip to content

chore: Document MIXED_EXPORTS rollup warning impact on CJS consumers #166

@untemps

Description

@untemps

Summary

`vite build` emits this warning on the CJS bundle:

```
[MIXED_EXPORTS] Warning: Entry module "src/index.ts" is using named
(including "classifyError", "default", "isSupported", "useCommands", "useVocal")
and default exports together. Consumers of your bundle will have to use
`chunk.default` to access the default export, which may not be what you want.
Use `output.exports: "named"` to disable this warning.
```

The CJS bundle ends with:

```
exports.classifyError=O,exports.default=A,exports.isSupported=g,exports.useCommands=x,exports.useVocal=y;
```

Pure CommonJS consumers (`const Vocal = require('@untemps/react-vocal')`) need `.default` to get the component. TS/ESM consumers with `esModuleInterop` are unaffected.

Action items

  • Document the CJS access pattern in the v2 release notes / README ("Migration" or "Usage with CJS").
  • Decide whether to keep the mixed shape (current behavior, ergonomic for ESM) or migrate to `output.exports: "named"` + drop the default export (forcing every consumer to `{ Vocal }` — breaking).
  • If keeping mixed, suppress the warning intentionally (e.g. via `output.exports: 'auto'` if Rollup still accepts the current shape).

Likely not a regression vs. 1.x, but worth confirming before the major bump.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bundleBundle configurationchoreMaintenance, tooling, testsdocumentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions