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
@@ -102,18 +102,15 @@ class WebpackConfig {
102
102
this.handlebarsConfigurationCallback=()=>{};
103
103
this.loaderConfigurationCallbacks={
104
104
javascript: ()=>{},
105
-
js: ()=>{},
106
105
css: ()=>{},
107
106
images: ()=>{},
108
107
fonts: ()=>{},
109
108
sass: ()=>{},
110
-
scss: ()=>{},
111
109
less: ()=>{},
112
110
stylus: ()=>{},
113
111
vue: ()=>{},
114
112
eslint: ()=>{},
115
113
typescript: ()=>{},
116
-
ts: ()=>{},
117
114
handlebars: ()=>{},
118
115
};
119
116
@@ -735,8 +732,19 @@ class WebpackConfig {
735
732
configureLoaderRule(name,callback){
736
733
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.');
737
734
735
+
// Key: alias, Value: existing loader in `this.loaderConfigurationCallbacks`
736
+
constaliases={
737
+
js: 'javascript',
738
+
ts: 'typescript',
739
+
scss: 'sass',
740
+
};
741
+
742
+
if(nameinaliases){
743
+
name=aliases[name];
744
+
}
745
+
738
746
if(!(nameinthis.loaderConfigurationCallbacks)){
739
-
thrownewError(`Loader "${name}" is not configurable. Valid loaders are "${Object.keys(this.loaderConfigurationCallbacks).join('", "')}".`);
747
+
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".');
1164
+
}).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