You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/WebpackConfig.js
+12-4Lines changed: 12 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -101,18 +101,15 @@ class WebpackConfig {
101
101
this.handlebarsConfigurationCallback=()=>{};
102
102
this.loaderConfigurationCallbacks={
103
103
javascript: ()=>{},
104
-
js: ()=>{},
105
104
css: ()=>{},
106
105
images: ()=>{},
107
106
fonts: ()=>{},
108
107
sass: ()=>{},
109
-
scss: ()=>{},
110
108
less: ()=>{},
111
109
stylus: ()=>{},
112
110
vue: ()=>{},
113
111
eslint: ()=>{},
114
112
typescript: ()=>{},
115
-
ts: ()=>{},
116
113
handlebars: ()=>{},
117
114
};
118
115
@@ -701,8 +698,19 @@ class WebpackConfig {
701
698
configureLoaderRule(name,callback){
702
699
logger.warning('Be careful when using Encore.configureLoaderRule(), this is a low-level method that can potentially breaks Encore and Webpack when not used carefully.');
703
700
701
+
// Key: alias, Value: existing loader in `this.loaderConfigurationCallbacks`
702
+
constaliases={
703
+
js: 'javascript',
704
+
ts: 'typescript',
705
+
scss: 'sass',
706
+
};
707
+
708
+
if(nameinaliases){
709
+
name=aliases[name];
710
+
}
711
+
704
712
if(!(nameinthis.loaderConfigurationCallbacks)){
705
-
thrownewError(`Loader "${name}" is not configurable. Valid loaders are "${Object.keys(this.loaderConfigurationCallbacks).join('", "')}".`);
713
+
thrownewError(`Loader "${name}" is not configurable. Valid loaders are "${Object.keys(this.loaderConfigurationCallbacks).join('", "')}" and the aliases "${Object.keys(aliases).join('", "')}".`);
thrownewError(`Loader "${name}" is not configurable. Valid loaders are "${Object.keys(this.webpackConfig.loaderConfigurationCallbacks).join('", "')}".`);
}).to.throw('Loader "reason" is not configurable. Valid loaders are "javascript", "js", "css", "images", "fonts", "sass", "scss", "less", "stylus", "vue", "eslint", "typescript", "ts", "handlebars".');
1103
+
}).to.throw('Loader "reason" is not configurable. Valid loaders are "javascript", "css", "images", "fonts", "sass", "less", "stylus", "vue", "eslint", "typescript", "handlebars" and the aliases "js", "ts", "scss".');
0 commit comments