<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>rollup on 编程那些事儿</title><link>https://before80.github.io/prgms/Js/tools/bundler/rollup/</link><description>Recent content in rollup on 编程那些事儿</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Sat, 28 Mar 2026 12:42:29 +0800</lastBuildDate><atom:link href="https://before80.github.io/prgms/Js/tools/bundler/rollup/index.xml" rel="self" type="application/rss+xml"/><item><title>第1章 什么是 Rollup</title><link>https://before80.github.io/prgms/Js/tools/bundler/rollup/Chapter-01-What-Is-Rollup/</link><pubDate>Sat, 28 Mar 2026 11:38:00 +0800</pubDate><guid>https://before80.github.io/prgms/Js/tools/bundler/rollup/Chapter-01-What-Is-Rollup/</guid><description>&lt;h1 id="第-1-章rollup-是什么"&gt;第 1 章　Rollup 是什么&lt;/h1&gt;
&lt;h2 id="11-官方定义专注于-es-module-的新一代打包工具"&gt;1.1 官方定义：专注于 ES Module 的新一代打包工具&lt;/h2&gt;
&lt;p&gt;如果把前端世界的打包工具比作一家餐厅，那 &lt;strong&gt;Rollup&lt;/strong&gt; 就是那个只做精品套餐、不卖自助餐的固执大厨。&lt;/p&gt;
&lt;p&gt;它的官方定义是这样的：&lt;strong&gt;Rollup 是一个 JavaScript 模块打包器（module bundler），专注于 ES Module 语法的打包工具&lt;/strong&gt;。听起来平平无奇对吧？就像说&amp;quot;这家餐厅是做菜的&amp;quot;一样敷衍。但魔鬼藏在细节里——它的核心卖点是&amp;quot;&lt;strong&gt;专注于 ES Module&lt;/strong&gt;&amp;ldquo;这五个字。&lt;/p&gt;</description></item><item><title>第2章 历史与演进</title><link>https://before80.github.io/prgms/Js/tools/bundler/rollup/Chapter-02-History-and-Evolution/</link><pubDate>Sat, 28 Mar 2026 11:38:00 +0800</pubDate><guid>https://before80.github.io/prgms/Js/tools/bundler/rollup/Chapter-02-History-and-Evolution/</guid><description>&lt;h1 id="第-2-章历史沿革与版本演进"&gt;第 2 章　历史沿革与版本演进&lt;/h1&gt;
&lt;hr&gt;
&lt;h2 id="21-诞生背景"&gt;2.1 诞生背景&lt;/h2&gt;
&lt;p&gt;2008 年，Chrome V8 引擎的诞生让 JavaScript 第一次有了&amp;quot;快&amp;quot;的可能；2015 年，ES6（ES2015）正式落地，JavaScript 有了官方的模块系统。就在这样的时代背景下，一个叫 &lt;strong&gt;Rich Harris&lt;/strong&gt; 的英国小哥，正在为自己的另一个作品——&lt;strong&gt;Svelte&lt;/strong&gt;（2016年正式发布）——寻找一个合适的打包工具。&lt;/p&gt;</description></item><item><title>第2章 历史与演进</title><link>https://before80.github.io/prgms/Js/tools/bundler/rollup/Chapter-02-What-Is-Rollup/</link><pubDate>Sat, 28 Mar 2026 11:38:00 +0800</pubDate><guid>https://before80.github.io/prgms/Js/tools/bundler/rollup/Chapter-02-What-Is-Rollup/</guid><description>&lt;h1 id="第-1-章rollup-是什么"&gt;第 1 章　Rollup 是什么&lt;/h1&gt;
&lt;h2 id="11-官方定义专注于-es-module-的新一代打包工具"&gt;1.1 官方定义：专注于 ES Module 的新一代打包工具&lt;/h2&gt;
&lt;p&gt;如果把前端世界的打包工具比作一家餐厅，那 &lt;strong&gt;Rollup&lt;/strong&gt; 就是那个只做精品套餐、不卖自助餐的固执大厨。&lt;/p&gt;
&lt;p&gt;它的官方定义是这样的：&lt;strong&gt;Rollup 是一个 JavaScript 模块打包器（module bundler），专注于 ES Module 语法的打包工具&lt;/strong&gt;。听起来平平无奇对吧？就像说&amp;quot;这家餐厅是做菜的&amp;quot;一样敷衍。但魔鬼藏在细节里——它的核心卖点是&amp;quot;&lt;strong&gt;专注于 ES Module&lt;/strong&gt;&amp;ldquo;这五个字。&lt;/p&gt;</description></item><item><title>第3章 有什么用</title><link>https://before80.github.io/prgms/Js/tools/bundler/rollup/Chapter-03-What-Is-It-Used-For/</link><pubDate>Sat, 28 Mar 2026 11:38:00 +0800</pubDate><guid>https://before80.github.io/prgms/Js/tools/bundler/rollup/Chapter-03-What-Is-It-Used-For/</guid><description>&lt;h1 id="第-3-章有什么用"&gt;第 3 章　有什么用&lt;/h1&gt;
&lt;h2 id="31-打包-javascript-库--npm-包"&gt;3.1 打包 JavaScript 库 / npm 包&lt;/h2&gt;
&lt;p&gt;这是 Rollup 最核心的使用场景，也是它的拿手好戏。如果你写了一个工具函数库、一个 UI 组件库，或者任何一个你想发布到 npm 上让其他开发者使用的项目，Rollup 几乎是你能找到的最佳打包方案。为什么这么说？&lt;/p&gt;</description></item><item><title>第4章 用在哪里</title><link>https://before80.github.io/prgms/Js/tools/bundler/rollup/Chapter-04-Where-Is-It-Used/</link><pubDate>Sat, 28 Mar 2026 11:38:00 +0800</pubDate><guid>https://before80.github.io/prgms/Js/tools/bundler/rollup/Chapter-04-Where-Is-It-Used/</guid><description>&lt;h1 id="第-4-章用在哪里"&gt;第 4 章　用在哪里&lt;/h1&gt;
&lt;hr&gt;
&lt;h2 id="41-开源库--npm-包发布"&gt;4.1 开源库 / npm 包发布&lt;/h2&gt;
&lt;p&gt;如果说 Rollup 是前端构建工具链中的瑞士军刀，那 npm 包发布就是它最闪耀的舞台。为啥？因为 Rollup 天生就是为了&amp;quot;精准投放&amp;quot;而生的——它只想把你写的代码打包成最小可用的形式，不会往包里塞一堆乱七八糟的东西。&lt;/p&gt;</description></item><item><title>第5章 怎么使用</title><link>https://before80.github.io/prgms/Js/tools/bundler/rollup/Chapter-05-How-To-Use-It/</link><pubDate>Sat, 28 Mar 2026 11:38:00 +0800</pubDate><guid>https://before80.github.io/prgms/Js/tools/bundler/rollup/Chapter-05-How-To-Use-It/</guid><description>&lt;h1 id="第-5-章怎么用"&gt;第 5 章　怎么用&lt;/h1&gt;
&lt;hr&gt;
&lt;h2 id="51-环境准备"&gt;5.1 环境准备&lt;/h2&gt;
&lt;h3 id="511-安装-nodejs推荐-lts-版本"&gt;5.1.1 安装 Node.js（推荐 LTS 版本）&lt;/h3&gt;
&lt;p&gt;Rollup 是一个 Node.js 的 npm 包，所以第一步当然是要安装 Node.js。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Node.js 是什么？&lt;/strong&gt;
Node.js 是一个让 JavaScript 可以在服务器端（也就是你的电脑，而不是浏览器）运行的环境。打个比方：如果 JavaScript 是&amp;quot;英语&amp;quot;，那么 Node.js 就是&amp;quot;同声传译设备&amp;quot;，让你能在中国用英语和英国人交流。安装 Rollup 之前，必须先安装 Node.js。&lt;/p&gt;</description></item><item><title>第6章 注意事项</title><link>https://before80.github.io/prgms/Js/tools/bundler/rollup/Chapter-06-Precautions/</link><pubDate>Sat, 28 Mar 2026 11:38:00 +0800</pubDate><guid>https://before80.github.io/prgms/Js/tools/bundler/rollup/Chapter-06-Precautions/</guid><description>&lt;h1 id="第-6-章需要注意哪些"&gt;第 6 章　需要注意哪些&lt;/h1&gt;
&lt;hr&gt;
&lt;h2 id="61-tree-shaking-的前提条件"&gt;6.1 Tree-Shaking 的前提条件&lt;/h2&gt;
&lt;p&gt;Tree-Shaking 是 Rollup 最招牌的功能，但它的效果取决于你如何使用它。理解它的前提条件，可以让你避免踩坑。&lt;/p&gt;
&lt;h3 id="611-必须使用-es-module-语法import--export"&gt;6.1.1 必须使用 ES Module 语法（import / export）&lt;/h3&gt;
&lt;p&gt;Tree-Shaking 只能作用于 ES Module 语法的代码。如果你的代码用的是 CommonJS 语法（&lt;code&gt;require()&lt;/code&gt; / &lt;code&gt;module.exports&lt;/code&gt;），Tree-Shaking 基本上无法工作。&lt;/p&gt;</description></item><item><title>第7章 相关配置</title><link>https://before80.github.io/prgms/Js/tools/bundler/rollup/Chapter-07-Related-Configuration/</link><pubDate>Sat, 28 Mar 2026 11:38:00 +0800</pubDate><guid>https://before80.github.io/prgms/Js/tools/bundler/rollup/Chapter-07-Related-Configuration/</guid><description>&lt;h1 id="第-7-章相关配置"&gt;第 7 章　相关配置&lt;/h1&gt;
&lt;hr&gt;
&lt;h2 id="71-输入配置input"&gt;7.1 输入配置（Input）&lt;/h2&gt;
&lt;p&gt;输入配置决定了&amp;quot;从哪里开始打包&amp;quot;，是整个 Rollup 配置的起点。&lt;/p&gt;
&lt;h3 id="711-input入口文件路径字符串--对象多入口--数组"&gt;7.1.1 input：入口文件路径（字符串 / 对象多入口 / 数组）&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;input&lt;/code&gt; 是&lt;strong&gt;必填项&lt;/strong&gt;（什么？你想不写？Rollup 会毫不客气地报错），它告诉 Rollup&amp;quot;从哪里开始找代码&amp;quot;。&lt;/p&gt;</description></item></channel></rss>