File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,9 @@ class WebpackConfig {
100
100
this . eslintLoaderOptionsCallback = ( ) => { } ;
101
101
this . tsConfigurationCallback = ( ) => { } ;
102
102
this . handlebarsConfigurationCallback = ( ) => { } ;
103
+ this . loaderConfigurationCallbacks = {
104
+ 'eslint' : ( ) => { } ,
105
+ } ;
103
106
104
107
// Plugins options
105
108
this . cleanWebpackPluginPaths = [ '**/*' ] ;
@@ -716,6 +719,18 @@ class WebpackConfig {
716
719
} ) ;
717
720
}
718
721
722
+ configureLoaderRule ( name , callback ) {
723
+ if ( ! ( name in this . loaderConfigurationCallbacks ) ) {
724
+ throw new Error ( `Loader "${ name } " is not configurable. Either open an issue or a pull request.` ) ;
725
+ }
726
+
727
+ if ( typeof callback !== 'function' ) {
728
+ throw new Error ( 'Argument 2 to configureLoaderRule() must be a callback function.' ) ;
729
+ }
730
+
731
+ this . loaderConfigurationCallbacks [ name ] = callback ;
732
+ }
733
+
719
734
useDevServer ( ) {
720
735
return this . runtimeConfig . useDevServer ;
721
736
}
Original file line number Diff line number Diff line change @@ -357,13 +357,13 @@ class ConfigGenerator {
357
357
}
358
358
359
359
if ( this . webpackConfig . useEslintLoader ) {
360
- rules . push ( {
360
+ rules . push ( applyOptionsCallback ( this . webpackConfig . loaderConfigurationCallbacks [ 'eslint' ] , {
361
361
test : / \. j s x ? $ / ,
362
362
loader : 'eslint-loader' ,
363
363
exclude : / n o d e _ m o d u l e s / ,
364
364
enforce : 'pre' ,
365
365
options : eslintLoaderUtil . getOptions ( this . webpackConfig )
366
- } ) ;
366
+ } ) ) ;
367
367
}
368
368
369
369
if ( this . webpackConfig . useTypeScriptLoader ) {
You can’t perform that action at this time.
0 commit comments