Skip to content

Commit

Permalink
docs(commonjs): output.exports recommendation also applies to IIFE (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red authored Dec 15, 2024
1 parent 75b9ca1 commit 3efaf75
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/commonjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ export default {
};
```

When bundling to CommonJS, i.e `output.format === 'cjs'`, make sure that you do not set `output.exports` to `'named'`. The default value of `'auto'` will usually work, but you can also set it explicitly to `'default'`. That makes sure that Rollup assigns the default export that was generated for your CommonJS entry point to `module.exports`, and semantics do not change.
When bundling to CommonJS or IIFE, i.e `output.format === 'cjs'` / `output.format === 'iife'`, make sure that you do not set `output.exports` to `'named'`. The default value of `'auto'` will usually work, but you can also set it explicitly to `'default'`. That makes sure that Rollup assigns the default export that was generated for your CommonJS entry point to `module.exports`, and semantics do not change.

## Using with @rollup/plugin-node-resolve

Expand Down

0 comments on commit 3efaf75

Please sign in to comment.