Skip to content

Commit

Permalink
enable sourcemaps in rollup config
Browse files Browse the repository at this point in the history
  • Loading branch information
raycohen committed Feb 24, 2018
1 parent 1b1d226 commit e31fd5f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ There are some existing React library boilerplates, but none of them fulfilled t
- Support importing CSS in your components (with css modules enabled by default)
- Note that CSS support will be a noop if you're using css-in-js
- Testing with [Jest](https://facebook.github.io/jest/), using `react-scripts` from `create-react-app`
- Sourcemap creation enabled by default
- Thorough documentation written by someone who cares :heart_eyes:

## Walkthrough
Expand Down Expand Up @@ -111,6 +112,21 @@ Here is a [branch](https://github.com/transitive-bullshit/react-modern-library-b

Here is a [branch](https://github.com/transitive-bullshit/react-modern-library-boilerplate/tree/feature/material-ui) which demonstrates how to create a module that makes use of a relatively complicated peer dependency, [material-ui](https://github.com/mui-org/material-ui). It shows the power of [rollup-plugin-peer-deps-external](https://www.npmjs.com/package/rollup-plugin-peer-deps-external) which makes it a breeze to create reusable modules that include complicated material-ui subcomponents without having them bundled as a part of your module.

## Sourcemaps

Sourcemaps are enabled in `rollup.config.js` resulting in `.map` files when you run a build:

```
dist/index.es.js
dist/index.es.js.map
dist/index.js
dist/index.js.map
```

The [sourcemap config option](https://rollupjs.org/guide/en#big-list-of-options) can also be set to `'inline'` to get sourcemaps appended inside the `.js` files themselves.

Note: create-react-app does not currently use the (source-map-loader)[https://github.com/webpack-contrib/source-map-loader] plugin, so it will not include sourcemaps from dependencies in the final build. See https://github.com/facebook/create-react-app/pull/2355 for updates.

## License

MIT © [Travis Fischer](https://github.com/transitive-bullshit)
6 changes: 4 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ export default {
output: [
{
file: pkg.main,
format: 'cjs'
format: 'cjs',
sourcemap: true
},
{
file: pkg.module,
format: 'es'
format: 'es',
sourcemap: true
}
],
plugins: [
Expand Down

0 comments on commit e31fd5f

Please sign in to comment.