Skip to content

Commit 37f0e35

Browse files
committed
build: optimize build bundle
1 parent 953fc1e commit 37f0e35

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"scripts": {
66
"prepare": "husky install",
77
"build": "rollup --bundleConfigAsCjs --config rollup.config.js",
8+
"build:types": "tsc --emitDeclarationOnly --declaration --outDir dist/types src/index.ts",
89
"build:core": "BUILD_TARGET=core rollup --bundleConfigAsCjs --config rollup.config.js",
910
"build:terser": "node scripts/build.js",
1011
"test:unit": "jest",

rollup.config.js

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ export default [
5151
typescript({
5252
tsconfig: 'tsconfig.json',
5353
include: ['src/**/*.ts'],
54-
// declaration: true,
55-
// declarationMap: true,
54+
declaration: false,
5655
outDir: 'dist/esm'
5756
}),
5857
json()
@@ -76,34 +75,32 @@ export default [
7675
typescript({
7776
tsconfig: 'tsconfig.json',
7877
include: ['src/**/*.ts'],
79-
// declaration: true,
80-
// declarationMap: true,
78+
declaration: false,
8179
outDir: 'dist/cjs'
8280
}),
8381
json()
8482
]
8583
},
8684
// Type declarations build (separate build for .d.ts files)
87-
{
88-
input: `src/${isCore ? 'core-index.ts' : 'index.ts'}`,
89-
output: {
90-
dir: 'dist/types',
91-
format: 'esm'
92-
},
93-
plugins: [
94-
resolve(),
95-
commonjs(),
96-
typescript({
97-
tsconfig: 'tsconfig.json',
98-
include: ['src/**/*.ts'],
99-
declaration: true,
100-
declarationMap: false,
101-
outDir: 'dist/types',
102-
emitDeclarationOnly: true
103-
}),
104-
json()
105-
]
106-
},
85+
// {
86+
// input: `src/${isCore ? 'core-index.ts' : 'index.ts'}`,
87+
// output: {
88+
// dir: 'dist/types',
89+
// format: 'esm'
90+
// },
91+
// plugins: [
92+
// resolve(),
93+
// commonjs(),
94+
// typescript({
95+
// tsconfig: 'tsconfig.json',
96+
// include: ['src/**/*.ts'],
97+
// declaration: true,
98+
// outDir: 'dist/types',
99+
// emitDeclarationOnly: true
100+
// }),
101+
// json()
102+
// ]
103+
// },
107104
// UMD build (JavaScript only)
108105
{
109106
input: `src/${isCore ? 'core-index.ts' : 'index.ts'}`,

src/tree.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function forEachDeep<V>(
4646
tree: ArrayLike<V>,
4747
parent: V | null,
4848
level: number
49-
) => boolean | undefined,
49+
) => boolean | void,
5050
options: { childField?: string; reverse?: boolean; breadthFirst?: boolean; isDomNode?: boolean } = {
5151
childField: 'children',
5252
reverse: false,

test/cloneDeep.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ describe('cloneDeep', () => {
6767
expect(cloned.b.c[1]).not.toBe(original.b.c[1]);
6868

6969
// 修改克隆对象不影响原始对象
70+
// @ts-ignore
7071
cloned.b.c[1].d = 4;
72+
// @ts-ignore
7173
expect(original.b.c[1].d).toBe(3);
7274
});
7375
//循环引用处理验证

0 commit comments

Comments
 (0)