Skip to content

Commit

Permalink
feat: add mako types (#12553)
Browse files Browse the repository at this point in the history
* feat: add mako types

* chore: remove moduleIdStrategy

* docs: config mako
  • Loading branch information
xiaohuoni authored Jul 11, 2024
1 parent 7182cdd commit 2a4c351
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/docs/docs/api/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,14 @@ legacy: {}
links: [{ href: '/foo.css', rel: 'preload' }],
```

## mako <Badge>4.3.2+</Badge>

- 类型: `{ plugins?: Array<{ load?: ((...args: any[]) => unknown) | undefined; generateEnd?: ((...args: any[]) => unknown) | undefined; }> | undefined; px2rem?: { root?: number | undefined; propBlackList?: Array<string> | undefined; propWhiteList?: Array<string> | undefined; selectorBlackList?: Array<string> | undefined; selectorWhiteList?: Array<string> | undefined; selectorDoubleList?: Array<string> | undefined; } | undefined; experimental?: { webpackSyntaxValidate?: Array<string> | undefined; } | undefined; flexBugs?: boolean | undefined; moduleIdStrategy?: string | undefined; optimization?: { skipModules?: boolean | undefined; } | undefined; }`
- 默认值: `{}`

使用 [mako](https://makojs.dev/) 用于编译以显著提高构建速度。
通过配置以启用这个能力,配置将传递给mako。这里只提供了一些常用的配置,更多的配置可以在 `mako.config.json` 文件中设置。有关更多信息,请参阅[mako-config文档](https://makojs.dev/docs/config)

## manifest

- 类型:`{ fileName: string; basePath: string }`
Expand Down
21 changes: 21 additions & 0 deletions packages/preset-umi/src/features/mako/mako.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,27 @@ export default (api: IApi) => {
})
.partial(),
),
px2rem: zod
.object({
root: zod.number(),
propBlackList: zod.array(zod.string()),
propWhiteList: zod.array(zod.string()),
selectorBlackList: zod.array(zod.string()),
selectorWhiteList: zod.array(zod.string()),
selectorDoubleList: zod.array(zod.string()),
})
.partial(),
experimental: zod
.object({
webpackSyntaxValidate: zod.array(zod.string()),
})
.partial(),
flexBugs: zod.boolean(),
optimization: zod
.object({
skipModules: zod.boolean(),
})
.partial(),
})
.partial();
},
Expand Down

0 comments on commit 2a4c351

Please sign in to comment.