Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to embed all dependencies into one fat target bundle with rollup.js?

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

like image 426
Natasha Avatar asked Sep 01 '18 05:09

Natasha


1 Answers

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

like image 83
Rich Harris Avatar answered Sep 23 '22 07:09

Rich Harris