Merge branch 'master' into release/next

This commit is contained in:
ClarkXia 2023-03-09 10:05:57 +08:00
commit 68e32b9dbd
7 changed files with 68 additions and 10 deletions

View File

@ -4,7 +4,7 @@
1. 保证 Node.js 版本是 Node.js 14 以上。推荐安装 Node.js 16+ 版本,会大大提升本地调试速度
2. ice.js 仓库是 `monorepo`,并使用 `pnpm workspace`。因此需要安装 [pnpm](https://pnpm.io/) 包管理工具
3. 在项目根目录下执行 `pnpm setup` 后会安装依赖和编译代码
3. 在项目根目录下执行 `pnpm run setup` 后会安装依赖和编译代码
> 如果在安装 puppeteer 的时候过慢,可以参考此 [issue](https://github.com/puppeteer/puppeteer/issues/6833#issuecomment-863488626) 进行配置 chromium 缓存。

View File

@ -51,8 +51,8 @@ Contributors can contact us to join the Contributor Group.
## Community
[issues]: https://github.com/alibaba/ice/issues
[gitter]: https://gitter.im/alibaba/ice
- [Issues](https://github.com/alibaba/ice/issues)
- [Gitter](https://gitter.im/alibaba/ice)
## LICENSE

View File

@ -5,8 +5,8 @@
"author": "ice-admin@alibaba-inc.com",
"license": "MIT",
"homepage": "https://v3.ice.work",
"repository": "ice-lab/ice-next",
"bugs": "https://github.com/ice-lab/ice-next/issues",
"repository": "alibaba/ice",
"bugs": "https://github.com/alibaba/ice/issues",
"scripts": {
"prepare": "husky install",
"setup": "rm -rf node_modules packages/*/node_modules && pnpm install && pnpm prebundle && pnpm build",

View File

@ -1,5 +1,11 @@
# Changelog
## 1.0.3
### Patch Changes
- 1e6a015d: fix: add icon style when config themePackage
## 1.0.2
### Patch Changes

View File

@ -1,6 +1,6 @@
{
"name": "@ice/plugin-fusion",
"version": "1.0.2",
"version": "1.0.3",
"description": "plugin for ICE while use fusion component",
"license": "MIT",
"type": "module",

View File

@ -33,8 +33,8 @@ function importIcon(iconPath: string, cssPrefix: string) {
name: 'transform-import-icon',
enforce: 'pre',
transformInclude(id: string) {
// Only transform source code.
return id.match(/\.(js|jsx|ts|tsx)$/) && !id.match(/node_modules/);
// Only transform source code and icon file.
return (id.match(/\.(js|jsx|ts|tsx)$/) && !id.match(/node_modules/)) || iconPath === id;
},
async transform(code: string, id: string, options: { isServer: boolean }) {
const { isServer } = options;
@ -47,6 +47,7 @@ function importIcon(iconPath: string, cssPrefix: string) {
if (id === entryFile) {
return `import '${iconPath}';\n${code}`;
} else if (id === iconPath) {
// Default cssPrefix for icon.scss.
return `$css-prefix: '${cssPrefix}';\n${code}`;
}
}

View File

@ -386,8 +386,8 @@ export default defineConfig(() => ({
小程序端不支持该配置。
:::
- 类型:`{ format: 'esm' | 'cjs'; bundle: boolean; ignores: IgnorePattern[]; externals: string[] }`
- 默认值:`{ format: 'esm', bundle: false, ignores: [], externals: [] }`
- 类型:`{ format: 'esm' | 'cjs'; bundle: boolean; ignores: IgnorePattern[]; externals: string[]; onDemand: boolean; }`
- 默认值:`{ format: 'esm', bundle: false, ignores: [], externals: [], onDemand: false }`
SSR / SSG 产物标准,推荐以 ESM 标准进行执行,如果希望打包成一个 cjs 模块,可以进行如下设置:
@ -434,6 +434,19 @@ export default defineConfig(() => ({
}));
```
通过 `onDemand` 参数,可以在执行 Server 端产物时,按需构建所需的问题,并且提供体验良好的模块热更新服务:
```js
import { defineConfig } from '@ice/app';
export default defineConfig(() => ({
server: {
onDemand: true,
format: 'esm',
},
}));
```
### routes
:::caution
@ -491,6 +504,44 @@ route('/about-you', 'about.tsx');
```
:::
#### config
对于简单的自定义场景,通过 `defineRoutes` 可以快速在约定式路由的基础上进行自定义。但对于大量自定义或者原配置式路由的升级项目,支持以 `config` 的字段指定路由信息:
```ts
import { defineConfig } from '@ice/app';
export default defineConfig({
routes: {
config: [
{
path: 'rewrite',
// 从 src/page 开始计算路径,并且需要写后缀。
component: 'sales/layout.tsx',
children: [
{
path: '/favorites',
component: 'sales/favorites.tsx',
},
{
path: 'overview',
component: 'sales/overview.tsx',
},
{
path: 'recommends',
component: 'sales/recommends.tsx',
},
],
},
{
path: '/',
component: 'index.tsx',
},
],
},
});
```
### sourceMap
- 类型:`boolean | string`