Skip to content

Commit

Permalink
docs(babel): add usage with commonjs. fixes #622
Browse files Browse the repository at this point in the history
  • Loading branch information
shellscape committed Jan 28, 2021
1 parent f75d5a7 commit 6b4b7b6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/babel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,23 @@ export default config;

Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api).

### Using With `@rollup/plugin-commonjs`

When using `@rollup/plugin-babel` with `@rollup/plugin-commonjs` in the same Rollup configuration, it's important to note that `@rollup/plugin-commonjs` _must_ be placed before this plugin in the `plugins` array for the two to work together properly. e.g.

```js
import { babel } from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';

const config = {
...
plugins: [
commonjs(),
babel({ babelHelpers: 'bundled' })
],
};
```

## Options

This plugin respects Babel [configuration files](https://babeljs.io/docs/en/configuration) by default and they are generally the best place to put your configuration.
Expand Down

0 comments on commit 6b4b7b6

Please sign in to comment.