23

How do I have to configure rollup.js (=> config file "rollup.config.js") if all dependencies should be embedded into the (fat) result bundle (especially: how to configure the rollup parameters "globals", "external", "plugins.babel.exclude")?

Let's say I have done something like:

> npm install dependency1 --save-dev
> npm install dependency2 --save-dev

And the index file (index.js) looks like:

import D1 from 'dependency1'
import D2 from 'dependency2'

[...]

export default SomethingThatUsesD1AndD2

=> The resulting bundle shall be one fat single file that contains everything

Natasha
  • 421
  • 1
  • 3
  • 10
  • 5
    Do not use `save-dev` for runtime dependencies. If you are `import`ing these dependencies in your `index.js`, you should install them with `npm install --save dependency1` – Stijn de Witt Jun 20 '20 at 20:53

1 Answers1

19

Use rollup-plugin-node-resolve (and rollup-plugin-commonjs if you have CommonJS dependencies).

sschmeck
  • 7,233
  • 4
  • 40
  • 67
Rich Harris
  • 28,091
  • 3
  • 84
  • 99
  • 1
    It's working now: One of the dependencies (a projects of mine) has been built with webpack ... I've switched the packer on that dependency project to "rollup" and it works fine with my other project's "rollup" build scripts ... think there was a problem with my webpack configuration of that dependency project. – Natasha Sep 01 '18 at 14:56