Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
perf(wechat): 缩小微信打包size
Browse files Browse the repository at this point in the history
  • Loading branch information
Darmody committed Jan 1, 2020
1 parent 5e2d871 commit e0e9798
Show file tree
Hide file tree
Showing 16 changed files with 711 additions and 1,976 deletions.
2 changes: 1 addition & 1 deletion packages/remax-cli/src/RemaxOptionsSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"type": "string"
},
"UNSAFE_wechatTemplateDepth": {
"type": "number"
"anyOf": [{ "type": "object" }, { "type": "number" }]
},
"alias": {
"type": "object"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { ensureDepth } from '../defaultOptions/UNSAFE_wechatTemplateDepth';

describe('UNSAFE_wechatTemplateDepth', () => {
it('ensure depth when input number', () => {
expect(ensureDepth(20)).toMatchInlineSnapshot(`
Object {
"ad": 20,
"audio": 20,
"button": 20,
"camera": 20,
"canvas": 20,
"checkbox": 20,
"checkbox-group": 20,
"cover-image": 20,
"cover-view": 20,
"editor": 20,
"form": 20,
"functional-page-navigator": 20,
"icon": 20,
"image": 20,
"input": 20,
"label": 20,
"live-player": 20,
"live-pusher": 20,
"map": 20,
"moveable-area": 20,
"moveable-view": 20,
"navigator": 20,
"official-account": 20,
"open-data": 20,
"picker": 20,
"picker-view": 20,
"picker-view-column": 20,
"progress": 20,
"radio": 20,
"radio-group": 20,
"rich-text": 20,
"scroll-view": 20,
"slider": 20,
"swiper": 20,
"text": 20,
"textarea": 20,
"video": 20,
"view": 20,
"web-view": 20,
}
`);
});
});
7 changes: 6 additions & 1 deletion packages/remax-cli/src/__tests__/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ describe('remax config', () => {
- configuration.compressTemplate should be a boolean.
- configuration.output should be a string.
- configuration.rootDir should be a string.
- configuration.UNSAFE_wechatTemplateDepth should be a number.
- configuration.UNSAFE_wechatTemplateDepth should be one of these:
object { … } | number
Details:
* configuration.UNSAFE_wechatTemplateDepth should be an object:
object { … }
* configuration.UNSAFE_wechatTemplateDepth should be a number.
- configuration.alias should be an object:
object { … }
- configuration.postcss.options should be an object:
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit e0e9798

Please sign in to comment.