@@ -113,7 +113,7 @@ export const PathFilters: { [name: string]: PathFilterFunction } = {
113113 } ,
114114
115115 /**
116- * Add [mathjax] before any relative path, and add .js if needed
116+ * Add [mathjax] before any relative path
117117 *
118118 * @param {PathFilterFunction } data The data object containing the filter functions
119119 * @returns {boolean } True
@@ -123,9 +123,6 @@ export const PathFilters: { [name: string]: PathFilterFunction } = {
123123 if ( ! name . match ( / ^ (?: [ a - z ] + : \/ ) ? \/ | [ a - z ] : \\ | \[ / i) ) {
124124 data . name = '[mathjax]/' + name . replace ( / ^ \. \/ / , '' ) ;
125125 }
126- if ( data . addExtension && ! name . match ( / \. [ ^ / ] + $ / ) ) {
127- data . name += '.js' ;
128- }
129126 return true ;
130127 } ,
131128
@@ -143,6 +140,19 @@ export const PathFilters: { [name: string]: PathFilterFunction } = {
143140 }
144141 return true ;
145142 } ,
143+
144+ /**
145+ * Add .js, if missing
146+ *
147+ * @param {PathFilterFunction } data The data object containing the filter functions
148+ * @returns {boolean } True
149+ */
150+ addExtension : ( data ) => {
151+ if ( data . addExtension && ! data . name . match ( / \. [ ^ / ] + $ / ) ) {
152+ data . name += '.js' ;
153+ }
154+ return true ;
155+ } ,
146156} ;
147157
148158/**
@@ -319,6 +329,7 @@ export const Loader = {
319329Loader . pathFilters . add ( PathFilters . source , 0 ) ;
320330Loader . pathFilters . add ( PathFilters . normalize , 10 ) ;
321331Loader . pathFilters . add ( PathFilters . prefix , 20 ) ;
332+ Loader . pathFilters . add ( PathFilters . addExtension , 30 ) ;
322333
323334/**
324335 * Export the global MathJax object for convenience
0 commit comments