@@ -4,27 +4,27 @@ import { createCompiler as baseCreateCompiler } from './createCompiler.js';
4
4
import { initConfigs } from './initConfigs.js' ;
5
5
import { inspectConfig } from './inspectConfig.js' ;
6
6
import { pluginAdaptor } from './plugin.js' ;
7
- import { createDevServer , initRsbuildConfig } from './shared.js' ;
8
7
9
8
export const webpackProvider : RsbuildProvider < 'webpack' > = async ( {
10
9
context,
11
10
pluginManager,
12
11
rsbuildOptions,
13
- setCssExtractPlugin ,
12
+ helpers ,
14
13
} ) => {
15
14
const { default : cssExtractPlugin } = await import ( 'mini-css-extract-plugin' ) ;
16
- setCssExtractPlugin ( cssExtractPlugin ) ;
15
+ helpers . setCssExtractPlugin ( cssExtractPlugin ) ;
17
16
18
17
const createCompiler = ( async ( ) => {
19
18
const result = await baseCreateCompiler ( {
20
19
context,
21
20
pluginManager,
22
21
rsbuildOptions,
22
+ helpers,
23
23
} ) ;
24
24
return result . compiler ;
25
25
} ) as CreateCompiler ;
26
26
27
- pluginManager . addPlugins ( [ pluginAdaptor ( ) ] ) ;
27
+ pluginManager . addPlugins ( [ pluginAdaptor ( helpers ) ] ) ;
28
28
29
29
return {
30
30
bundler : 'webpack' ,
@@ -36,13 +36,17 @@ export const webpackProvider: RsbuildProvider<'webpack'> = async ({
36
36
context,
37
37
pluginManager,
38
38
rsbuildOptions,
39
+ helpers,
39
40
} ) ;
40
41
return webpackConfigs ;
41
42
} ,
42
43
43
44
async createDevServer ( options ) {
44
- const config = await initRsbuildConfig ( { context, pluginManager } ) ;
45
- return createDevServer (
45
+ const config = await helpers . initRsbuildConfig ( {
46
+ context,
47
+ pluginManager,
48
+ } ) ;
49
+ return helpers . createDevServer (
46
50
{ context, pluginManager, rsbuildOptions } ,
47
51
createCompiler ,
48
52
config ,
@@ -51,11 +55,11 @@ export const webpackProvider: RsbuildProvider<'webpack'> = async ({
51
55
} ,
52
56
53
57
async startDevServer ( options ) {
54
- const config = await initRsbuildConfig ( {
58
+ const config = await helpers . initRsbuildConfig ( {
55
59
context,
56
60
pluginManager,
57
61
} ) ;
58
- const server = await createDevServer (
62
+ const server = await helpers . createDevServer (
59
63
{
60
64
context,
61
65
pluginManager,
@@ -70,7 +74,10 @@ export const webpackProvider: RsbuildProvider<'webpack'> = async ({
70
74
} ,
71
75
72
76
async build ( options ) {
73
- return build ( { context, pluginManager, rsbuildOptions } , options ) ;
77
+ return build (
78
+ { context, pluginManager, rsbuildOptions, helpers } ,
79
+ options ,
80
+ ) ;
74
81
} ,
75
82
76
83
async inspectConfig ( inspectOptions ) {
@@ -79,6 +86,7 @@ export const webpackProvider: RsbuildProvider<'webpack'> = async ({
79
86
pluginManager,
80
87
rsbuildOptions,
81
88
inspectOptions,
89
+ helpers,
82
90
} ) ;
83
91
} ,
84
92
} ;
0 commit comments