-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dev/devtools-integrate-doctor
- Loading branch information
Showing
45 changed files
with
1,812 additions
and
1,771 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@modern-js/prod-server': minor | ||
'@modern-js/server-core': minor | ||
--- | ||
|
||
feat: add server SSR fallback hook | ||
feat: 新增 server SSR 降级 hook 实现 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@modern-js/uni-builder': patch | ||
--- | ||
|
||
chore(deps): bump rsbuild 0.4.3 | ||
|
||
chore(deps): 升级 rsbuild 到 0.4.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@modern-js/uni-builder': patch | ||
--- | ||
|
||
chore(uni-builder): set babel-post plugin order to 'post' | ||
|
||
chore(uni-builder): 将 babel-post 顺序调整为 'post' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { isServerTarget, type RsbuildPlugin } from '@rsbuild/shared'; | ||
|
||
const getAntdMajorVersion = (appDirectory: string) => { | ||
try { | ||
const pkgJsonPath = require.resolve('antd/package.json', { | ||
paths: [appDirectory], | ||
}); | ||
const { version } = require(pkgJsonPath); | ||
return Number(version.split('.')[0]); | ||
} catch (err) { | ||
return null; | ||
} | ||
}; | ||
|
||
export const pluginAntd = (): RsbuildPlugin => ({ | ||
name: 'uni-builder:antd', | ||
setup(api) { | ||
api.modifyRsbuildConfig(rsbuildConfig => { | ||
rsbuildConfig.source ??= {}; | ||
|
||
if ( | ||
rsbuildConfig.source.transformImport === false || | ||
rsbuildConfig.source.transformImport?.some( | ||
item => item.libraryName === 'antd', | ||
) | ||
) { | ||
return; | ||
} | ||
|
||
const antdMajorVersion = getAntdMajorVersion(api.context.rootPath); | ||
// antd >= v5 no longer need babel-plugin-import | ||
// see: https://ant.design/docs/react/migration-v5#remove-babel-plugin-import | ||
if (antdMajorVersion && antdMajorVersion < 5) { | ||
rsbuildConfig.source ??= {}; | ||
rsbuildConfig.source.transformImport = [ | ||
...(rsbuildConfig.source.transformImport || []), | ||
{ | ||
libraryName: 'antd', | ||
libraryDirectory: isServerTarget(api.context.targets) | ||
? 'lib' | ||
: 'es', | ||
style: true, | ||
}, | ||
]; | ||
} | ||
}); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { isServerTarget, type RsbuildPlugin } from '@rsbuild/shared'; | ||
import { isPackageInstalled } from '@modern-js/utils'; | ||
|
||
export const pluginArco = (): RsbuildPlugin => ({ | ||
name: 'uni-builder:arco', | ||
|
||
setup(api) { | ||
const ARCO_NAME = '@arco-design/web-react'; | ||
const ARCO_ICON = `${ARCO_NAME}/icon`; | ||
|
||
api.modifyRsbuildConfig(rsbuildConfig => { | ||
const { transformImport = [] } = rsbuildConfig.source || {}; | ||
|
||
if ( | ||
transformImport === false || | ||
!isPackageInstalled(ARCO_NAME, api.context.rootPath) | ||
) { | ||
return; | ||
} | ||
|
||
const isUseSSR = isServerTarget(api.context.targets); | ||
|
||
if (!transformImport?.some(item => item.libraryName === ARCO_NAME)) { | ||
transformImport.push({ | ||
libraryName: ARCO_NAME, | ||
libraryDirectory: isUseSSR ? 'lib' : 'es', | ||
camelToDashComponentName: false, | ||
style: true, | ||
}); | ||
} | ||
|
||
if (!transformImport?.some(item => item.libraryName === ARCO_ICON)) { | ||
transformImport.push({ | ||
libraryName: ARCO_ICON, | ||
libraryDirectory: isUseSSR ? 'react-icon-cjs' : 'react-icon', | ||
camelToDashComponentName: false, | ||
}); | ||
} | ||
|
||
rsbuildConfig.source ||= {}; | ||
rsbuildConfig.source.transformImport = transformImport; | ||
}); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 2 additions & 6 deletions
8
packages/builder/uni-builder/src/shared/plugins/splitChunk.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.