Skip to content

Commit

Permalink
✨ feat: 引入unbuild&优化依赖体积
Browse files Browse the repository at this point in the history
  • Loading branch information
seho-dev committed Dec 1, 2021
1 parent 0cea36c commit 348c6ba
Show file tree
Hide file tree
Showing 12 changed files with 4,483 additions and 2,080 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# rollup-typescript-package

- [x] 基础的校验机制,保证代码美观符合生产环境
- [x] 自带 babel,rollup,eslint 等配置,开发 lib 直接就能上手
- [x] 提供了 rollup 并行打包,多模块输出等功能
- [x] 使用[unbuild](https://github.com/unjs/unbuild)进行打包

## 命令

| 命令 | 含义 |
| --------- | --------------------------- |
| build | 并行打包所有类型的 lib |
| build:esm | 打包 esmodule 版本的 lib |
| build:umd | 打包 umd 版本的 lib |
| build:min | 打包压缩版的 umd 版本的 lib |
| 命令 | 含义 |
| ----- | ---------------------- |
| build | 并行打包所有类型的 lib |

## 技术栈:

Expand Down
8 changes: 8 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineBuildConfig } from 'unbuild';

export default defineBuildConfig({
entries: ['./src/index'],
outDir: 'lib',
declaration: true,
cjsBridge: true
});
13 changes: 0 additions & 13 deletions index.html

This file was deleted.

9 changes: 9 additions & 0 deletions lib/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const sum = function(a, b) {
return a + b;
};

exports.sum = sum;
3 changes: 3 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare const sum: (a: number, b: number) => number;

export { sum };
2 changes: 1 addition & 1 deletion lib/index.esm.js → lib/index.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var sum = function sum(a, b) {
const sum = function(a, b) {
return a + b;
};

Expand Down
15 changes: 0 additions & 15 deletions lib/index.umd.js

This file was deleted.

1 change: 0 additions & 1 deletion lib/index.umd.min.js

This file was deleted.

Loading

0 comments on commit 348c6ba

Please sign in to comment.