File tree Expand file tree Collapse file tree
webpack/localization-plugin/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,11 +76,11 @@ export class WebpackConfigurationUpdater {
7676 options . configuration ,
7777 [
7878 {
79- test : / \. l o c \. j s o n $ / i ,
79+ test : Constants . LOC_JSON_REGEX ,
8080 loader : loader
8181 } ,
8282 {
83- test : / \. r e s x $ / i ,
83+ test : Constants . RESX_REGEX ,
8484 use : [
8585 require . resolve ( 'json-loader' ) ,
8686 {
@@ -134,7 +134,7 @@ export class WebpackConfigurationUpdater {
134134 test : {
135135 and : [
136136 ( filePath : string ) => options . locFiles . has ( filePath ) ,
137- / \. l o c \. j s o n $ / i
137+ Constants . LOC_JSON_REGEX
138138 ]
139139 } ,
140140 loader : loader ,
@@ -144,7 +144,7 @@ export class WebpackConfigurationUpdater {
144144 test : {
145145 and : [
146146 ( filePath : string ) => options . locFiles . has ( filePath ) ,
147- / \. r e s x $ / i
147+ Constants . RESX_REGEX
148148 ]
149149 } ,
150150 use : [
@@ -172,12 +172,7 @@ export class WebpackConfigurationUpdater {
172172 and : [
173173 ( filePath : string ) => ! options . locFiles . has ( filePath ) ,
174174 ( filePath : string ) => ! options . filesToIgnore . has ( filePath ) ,
175- {
176- or : [
177- / \. l o c \. j s o n $ / i,
178- / \. r e s x $ / i
179- ]
180- }
175+ Constants . RESX_OR_LOC_JSON_REGEX
181176 ]
182177 } ,
183178 loader : path . resolve ( __dirname , 'loaders' , 'MissingLocDataWarningLoader.js' )
Original file line number Diff line number Diff line change @@ -16,4 +16,8 @@ export class Constants {
1616 'g'
1717 ) ;
1818 public static STRING_PLACEHOLDER_PREFIX : string = '-LOCALIZED-STRING-f12dy0i7-n4bo-dqwj-39gf-sasqehjmihz9' ;
19+
20+ public static RESX_REGEX : RegExp = / \. r e s x $ / i;
21+ public static LOC_JSON_REGEX : RegExp = / \. l o c \. j s o n $ / i;
22+ public static RESX_OR_LOC_JSON_REGEX : RegExp = / \. ( r e s x | l o c \. j s o n ) $ / i;
1923}
You can’t perform that action at this time.
0 commit comments