@bundlekit/bundler-rollup 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# @bundlekit/bundler-rollup
|
|
2
|
+
|
|
3
|
+
Rollup 打包器适配器,为 @bundlekit/service 提供 Rollup 4 构建支持。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -D @bundlekit/bundler-rollup
|
|
9
|
+
# 或
|
|
10
|
+
pnpm add -D @bundlekit/bundler-rollup
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 使用
|
|
14
|
+
|
|
15
|
+
### 自动配置
|
|
16
|
+
|
|
17
|
+
在 `@bundlekit/cli` 创建项目时选择 rollup:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
bc create my-app -b rollup
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 手动配置
|
|
24
|
+
|
|
25
|
+
在 `.bundlekitrc.ts` 中指定 bundler:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
ds serve --bundler rollup
|
|
29
|
+
ds build --bundler rollup
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## 功能特性
|
|
33
|
+
|
|
34
|
+
- ✅ Rollup 4 支持
|
|
35
|
+
- ✅ Tree Shaking
|
|
36
|
+
- ✅ ES Module 输出
|
|
37
|
+
- ✅ TypeScript / JavaScript
|
|
38
|
+
- ✅ CSS / Less / Sass
|
|
39
|
+
- ✅ Library 模式
|
|
40
|
+
- ✅ SSR 支持
|
|
41
|
+
- ✅ 插件生态丰富
|
|
42
|
+
|
|
43
|
+
## 配置示例
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
export default defineConfig({
|
|
47
|
+
config: {
|
|
48
|
+
production: {
|
|
49
|
+
entry: 'src/index.tsx',
|
|
50
|
+
output: {
|
|
51
|
+
dir: 'dist',
|
|
52
|
+
filename: '[name].js',
|
|
53
|
+
formats: 'esm',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
tools: {
|
|
58
|
+
rollup: (config) => {
|
|
59
|
+
// 修改 rollup 配置
|
|
60
|
+
return config;
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Library 模式
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
export default defineConfig({
|
|
70
|
+
config: {
|
|
71
|
+
production: {
|
|
72
|
+
entry: 'src/index.ts',
|
|
73
|
+
output: {
|
|
74
|
+
dir: 'dist',
|
|
75
|
+
filename: 'index.js',
|
|
76
|
+
formats: 'esm',
|
|
77
|
+
},
|
|
78
|
+
library: true,
|
|
79
|
+
libraryName: 'MyLibrary',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 特有配置
|
|
86
|
+
|
|
87
|
+
| 配置项 | 说明 |
|
|
88
|
+
|--------|------|
|
|
89
|
+
| `tools.rollup` | rollup 原生配置修改钩子 |
|
|
90
|
+
| `library` | 启用 Library 模式 |
|
|
91
|
+
| `libraryName` | UMD/IIFE 模式导出名称 |
|
|
92
|
+
| `output.formats` | 输出格式(esm/commonjs/umd/iife) |
|
|
93
|
+
|
|
94
|
+
## 文档
|
|
95
|
+
|
|
96
|
+
完整文档请访问 [https://bundlekit.dev](https://bundlekit.dev)
|
|
97
|
+
|
|
98
|
+
## License
|
|
99
|
+
|
|
100
|
+
ISC
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bundlekit/bundler-rollup",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "A rollup bundler for @bundlekit/service",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"rollup": "^4.40.0",
|
|
31
31
|
"rollup-plugin-postcss": "^4.0.2",
|
|
32
32
|
"schema-utils": "^4.3.0",
|
|
33
|
-
"@bundlekit/shared-utils": "0.0.
|
|
33
|
+
"@bundlekit/shared-utils": "0.0.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@rollup/plugin-terser": "^0.4.4",
|