File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,9 +10,9 @@ export const watch = async (opts: any) => {
1010 await watchWebpack ( opts ) ;
1111} ;
1212
13- export const devServer = async ( opts : any ) => {
13+ export const devServer = async ( opts : any , configWrapper ?: ( webpackConfig : any ) => any ) => {
1414 const { runWebpackDevServer } = await import ( '../utils/webpack-dev-server' ) ;
15- await runWebpackDevServer ( opts ) ;
15+ await runWebpackDevServer ( opts , configWrapper ) ;
1616} ;
1717
1818export const dll = async ( opts : any ) => {
Original file line number Diff line number Diff line change @@ -41,7 +41,10 @@ const stats = {
4141 children : false ,
4242} ;
4343
44- export const runWebpackDevServer = async ( opts : IOptions < IExtraOptions > ) => {
44+ export const runWebpackDevServer = async (
45+ opts : IOptions < IExtraOptions > ,
46+ configWrapper ?: ( webpackConfig : webpack . Configuration ) => webpack . Configuration ,
47+ ) => {
4548 let webpackConfig = await getWebpackConfig ( opts ) ;
4649
4750 if ( opts . pipeConfig ) {
@@ -131,6 +134,10 @@ export const runWebpackDevServer = async (opts: IOptions<IExtraOptions>) => {
131134 webpackConfig = smp . wrap ( webpackConfig ) ;
132135 }
133136
137+ if ( configWrapper ) {
138+ webpackConfig = configWrapper ( webpackConfig ) ;
139+ }
140+
134141 const compiler = webpack ( webpackConfig ) ;
135142
136143 const devServer = new WebpackDevServer ( compiler as any , webpackDevServerConfig ) ;
You can’t perform that action at this time.
0 commit comments