File tree 7 files changed +489
-290
lines changed
7 files changed +489
-290
lines changed Original file line number Diff line number Diff line change 40
40
"node" : " >=16.0.0"
41
41
},
42
42
"dependencies" : {
43
+ "@babel/core" : " ^7.22.17" ,
43
44
"@module-federation/fmr" : " ^0.0.7" ,
44
45
"@pmmmwh/react-refresh-webpack-plugin" : " ^0.5.13" ,
45
46
"@renzp/css-scoped-loader" : " ^0.0.16" ,
52
53
"@soda/friendly-errors-webpack-plugin" : " ^1.8.1" ,
53
54
"@svgr/webpack" : " ^6.5.1" ,
54
55
"@swc/core" : " 1.3.32" ,
56
+ "babel-loader" : " ^9.1.3" ,
55
57
"browserslist" : " ^4.23.0" ,
56
58
"cac" : " ^6.7.14" ,
57
59
"compression" : " ^1.7.4" ,
80
82
"postcss-normalize" : " ^10.0.1" ,
81
83
"postcss-preset-env" : " ^7.8.3" ,
82
84
"react-refresh" : " ^0.14.2" ,
85
+ "rzpack-babel-preset" : " ^0.0.2" ,
83
86
"rzpack-ui" : " workspace:*" ,
84
87
"rzpack-utils" : " workspace:*" ,
85
88
"sirv" : " ^2.0.4" ,
Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ export type RzpackChain = (w: WebpackChain) => WebpackChain
96
96
export const defineConfig = ( configs : RzpackConfigs ) => configs
97
97
98
98
export enum JSX_TOOLS {
99
+ BABEL = 'babel' ,
99
100
ESBUILD = 'esbuild' ,
100
101
SWC = 'swc' ,
101
102
}
Original file line number Diff line number Diff line change
1
+ import { requireResolve } from 'rzpack-utils'
2
+ import type WebpackChain from 'webpack-chain'
3
+
4
+ export default ( webpackChain : WebpackChain ) => {
5
+ // 配置babel
6
+ return webpackChain . module
7
+ . rule ( 'babel' )
8
+ . test ( / \. [ t j ] s x ? $ / )
9
+ . exclude . add ( / n o d e _ m o d u l e s / )
10
+ . end ( )
11
+ . use ( 'babel' )
12
+ . loader ( requireResolve ( 'babel-loader' ) )
13
+ . options ( {
14
+ cacheDirectory : true ,
15
+ presets : [ requireResolve ( 'rzpack-babel-preset' ) ] ,
16
+ } )
17
+ . end ( )
18
+ }
Original file line number Diff line number Diff line change @@ -2,12 +2,14 @@ import { requireResolve } from 'rzpack-utils'
2
2
import type WebpackChain from 'webpack-chain'
3
3
import { JSX_TOOLS } from '../../..'
4
4
import type { RzpackAssets } from '../index'
5
+ import babel from './babel'
5
6
import esbuild from './esbuild'
6
7
import swc from './swc'
7
8
8
9
export default ( webpackChain : WebpackChain , assets : RzpackAssets ) => {
9
10
const { jsxTools = JSX_TOOLS . ESBUILD , cssScoped } = assets ?? { }
10
11
const transformTools = {
12
+ [ JSX_TOOLS . BABEL ] : babel ,
11
13
[ JSX_TOOLS . ESBUILD ] : esbuild ,
12
14
[ JSX_TOOLS . SWC ] : swc ,
13
15
}
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ export default (
27
27
28
28
const minimizers = {
29
29
swc : esbuildMinimizer ,
30
+ babel : esbuildMinimizer ,
30
31
esbuild : esbuildMinimizer ,
31
32
}
32
33
Original file line number Diff line number Diff line change 1
1
import { BUILDER , JSX_TOOLS , defineConfig } from 'rzpack'
2
2
3
3
export default defineConfig ( {
4
- builder : BUILDER . RSPACK ,
4
+ // builder: BUILDER.RSPACK,
5
5
html : {
6
6
title : 'rzpack-antd' ,
7
7
} ,
@@ -12,7 +12,7 @@ export default defineConfig({
12
12
file : './src/theme/globalVars.ts' ,
13
13
} ,
14
14
assets : {
15
- jsxTools : JSX_TOOLS . ESBUILD ,
15
+ jsxTools : JSX_TOOLS . BABEL ,
16
16
cssScoped : true ,
17
17
} ,
18
18
gzip :true ,
You can’t perform that action at this time.
0 commit comments