Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(en): merge rollup/master into rollup-docs-cn/master @ c16c9241 #148

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/introduction/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ npm install --global rollup

这些命令假定你的应用程序入口点命名为 `main.js`,并且希望将所有导入编译到一个名为 `bundle.js` 的单个文件中。

<<<<<<< HEAD
对于浏览器:

```shell
Expand All @@ -48,6 +49,28 @@ rollup main.js --file bundle.js --format umd --name "myBundle"
```

## 背景 {#the-why}
=======
::: code-group

```shell [For browsers:]
# compile to a <script> containing a self-executing function ('iife')
$ rollup main.js --file bundle.js --format iife
```

```shell [For Node.js:]
# compile to a CommonJS module ('cjs')
$ rollup main.js --file bundle.js --format cjs
```

```shell [For both browsers and Node.js:]
# UMD format requires a bundle name
$ rollup main.js --file bundle.js --format umd --name "myBundle"
```

:::

## The Why
>>>>>>> c16c92411619df4dff80536fe0ea0c5d945f829e

将项目分解为较小的独立部分通常可以使软件开发更加容易,因为这通常可以消除意外的交互,并大大减少你需要解决的问题的复杂性,而仅仅是首先编写较小的项目 [并不一定是最好的方式](https://medium.com/@Rich_Harris/small-modules-it-s-not-quite-that-simple-3ca532d65de4)。不幸的是,JavaScript 在历史上并没有将这种能力作为语言的核心特性之一。这在 ES6 版本的 JavaScript 中得到了改变,该版本包括一种语法,用于导入和导出函数和数据,以便它们可以在单独的脚本之间共享。

Expand Down
Loading
Loading