简体   繁体   English

如何使用 rollup.js 将所有依赖项嵌入到一个胖目标包中?

[英]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")?如果所有依赖项都应嵌入到(胖)结果包中(尤其是:如何配置汇总参数“globals”、“external”,我该如何配置 rollup.js(=> 配置文件“rollup.config.js”) ", "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:索引文件 (index.js) 如下所示:

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

[...]

export default SomethingThatUsesD1AndD2

=> The resulting bundle shall be one fat single file that contains everything => 生成的包应该是一个包含所有内容的单一文件

Use rollup-plugin-node-resolve (androllup-plugin-commonjs if you have CommonJS dependencies).使用rollup-plugin-node-resolve (如果您有 CommonJS 依赖项,则使用rollup-plugin-commonjs )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM