-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: bump rsbuild to 0.2.17 & update rspack babel plugin (#5189)
- Loading branch information
Showing
16 changed files
with
442 additions
and
133 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/uni-builder': patch | ||
--- | ||
|
||
chore(deps): bump rsbuild to 0.2.17 | ||
|
||
chore(deps): 升级 rsbuild 到 0.2.17 |
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
30 changes: 30 additions & 0 deletions
30
packages/builder/uni-builder/src/rspack/plugins/babel-post.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import lodash from 'lodash'; | ||
import { type RsbuildPlugin } from '@rsbuild/shared'; | ||
import { getDefaultBabelOptions } from '@rsbuild/plugin-babel'; | ||
|
||
/** | ||
* should not set babel-loader when babel config not modified | ||
*/ | ||
export const pluginBabelPost = (): RsbuildPlugin => ({ | ||
name: 'uni-builder:babel-post', | ||
|
||
pre: ['rsbuild:babel'], | ||
|
||
setup(api) { | ||
api.modifyBundlerChain(async (chain, { CHAIN_ID }) => { | ||
if (chain.module.rules.get(CHAIN_ID.RULE.JS)) { | ||
const babelLoaderOptions = chain.module | ||
.rule(CHAIN_ID.RULE.JS) | ||
.use(CHAIN_ID.USE.BABEL) | ||
.get('options'); | ||
|
||
if ( | ||
babelLoaderOptions && | ||
lodash.isEqual(getDefaultBabelOptions(), babelLoaderOptions) | ||
) { | ||
chain.module.rule(CHAIN_ID.RULE.JS).uses.delete(CHAIN_ID.USE.BABEL); | ||
} | ||
} | ||
}); | ||
}, | ||
}); |
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
206 changes: 206 additions & 0 deletions
206
packages/builder/uni-builder/tests/__snapshots__/babel.test.ts.snap
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.