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 @ 8b967917 #149

Merged
merged 11 commits into from
Aug 1, 2024
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# rollup changelog

## 4.19.1

_2024-07-27_

### Bug Fixes

- Do not remove parantheses when tree-shaking logical expressions (#5584)
- Do not ignore side effects in calls left of an optional chaining operator (#5589)

### Pull Requests

- [#5584](https://github.com/rollup/rollup/pull/5584): fix: find whitespace from operator position to start (@TrickyPi)
- [#5587](https://github.com/rollup/rollup/pull/5587): docs: improve command by code-group (@thinkasany, @lukastaegert)
- [#5589](https://github.com/rollup/rollup/pull/5589): Fix side effect detection in optional chains (@lukastaegert)
- [#5592](https://github.com/rollup/rollup/pull/5592): chore(deps): lock file maintenance minor/patch updates (@renovate[bot])
- [#5593](https://github.com/rollup/rollup/pull/5593): chore(deps): lock file maintenance minor/patch updates (@renovate[bot])
- [#5594](https://github.com/rollup/rollup/pull/5594): chore(deps): lock file maintenance (@renovate[bot])
- [#5595](https://github.com/rollup/rollup/pull/5595): chore(deps): lock file maintenance (@renovate[bot])

## 4.19.0

_2024-07-20_
Expand Down
2 changes: 1 addition & 1 deletion browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/browser",
"version": "4.19.0",
"version": "4.19.1",
"description": "Next-generation ES module bundler browser build",
"main": "dist/rollup.browser.js",
"module": "dist/es/rollup.browser.js",
Expand Down
20 changes: 9 additions & 11 deletions docs/introduction/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,25 @@ npm install --global rollup

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

对于浏览器:
::: code-group

```shell
```shell [浏览器]
# 编译为包含自执行函数('iife')的 <script>。
rollup main.js --file bundle.js --format iife
$ rollup main.js --file bundle.js --format iife
```

对于 Node.js:

```shell
```shell [Node.js]
# 编译为一个 CommonJS 模块 ('cjs')
rollup main.js --file bundle.js --format cjs
$ rollup main.js --file bundle.js --format cjs
```

对于浏览器和 Node.js:

```shell
```shell [浏览器和 Node.js]
# UMD 格式需要一个包名
rollup main.js --file bundle.js --format umd --name "myBundle"
$ rollup main.js --file bundle.js --format umd --name "myBundle"
```

:::

## 背景 {#the-why}

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