@@ -196,11 +196,14 @@ public function getConfigFileRelativePath()
196196 */
197197 public function getMixinsFileRelativePath ()
198198 {
199- $ map = $ this ->getRepositoryFilesMap (Config::MIXINS_FILE_NAME , [
200- 'area ' => $ this ->staticContext ->getAreaCode (),
201- 'theme ' => $ this ->staticContext ->getThemePath (),
202- 'locale ' => $ this ->staticContext ->getLocale (),
203- ]);
199+ $ map = $ this ->getRepositoryFilesMap (
200+ Config::MIXINS_FILE_NAME ,
201+ [
202+ 'area ' => $ this ->staticContext ->getAreaCode (),
203+ 'theme ' => $ this ->staticContext ->getThemePath (),
204+ 'locale ' => $ this ->staticContext ->getLocale (),
205+ ]
206+ );
204207 if ($ map ) {
205208 $ relativePath = implode ('/ ' , $ map ) . '/ ' . Config::MIXINS_FILE_NAME ;
206209 } else {
@@ -254,11 +257,14 @@ public function getMinResolverRelativePath()
254257 */
255258 public function getUrlResolverFileRelativePath ()
256259 {
257- $ map = $ this ->getRepositoryFilesMap (Config::URL_RESOLVER_FILE_NAME , [
258- 'area ' => $ this ->staticContext ->getAreaCode (),
259- 'theme ' => $ this ->staticContext ->getThemePath (),
260- 'locale ' => $ this ->staticContext ->getLocale (),
261- ]);
260+ $ map = $ this ->getRepositoryFilesMap (
261+ Config::URL_RESOLVER_FILE_NAME ,
262+ [
263+ 'area ' => $ this ->staticContext ->getAreaCode (),
264+ 'theme ' => $ this ->staticContext ->getThemePath (),
265+ 'locale ' => $ this ->staticContext ->getLocale (),
266+ ]
267+ );
262268 if ($ map ) {
263269 $ relativePath = implode ('/ ' , $ map ) . '/ ' . Config::URL_RESOLVER_FILE_NAME ;
264270 } else {
@@ -278,6 +284,8 @@ public function getMapFileRelativePath()
278284 }
279285
280286 /**
287+ * Get path to configuration file
288+ *
281289 * @return string
282290 */
283291 protected function getConfigFileName ()
@@ -286,19 +294,22 @@ protected function getConfigFileName()
286294 }
287295
288296 /**
297+ * Get resolver code which RequireJS fetch minified files instead
298+ *
289299 * @return string
290300 */
291301 public function getMinResolverCode ()
292302 {
293- $ excludes = [];
303+ $ excludes = [' url.indexOf(baseUrl) === 0 ' ];
294304 foreach ($ this ->minification ->getExcludes ('js ' ) as $ expression ) {
295305 $ excludes [] = '!url.match(/ ' . str_replace ('/ ' , '\/ ' , $ expression ) . '/) ' ;
296306 }
297307 $ excludesCode = empty ($ excludes ) ? 'true ' : implode ('&& ' , $ excludes );
298308
299309 $ result = <<<code
300310 var ctx = require.s.contexts._,
301- origNameToUrl = ctx.nameToUrl;
311+ origNameToUrl = ctx.nameToUrl,
312+ baseUrl = ctx.config.baseUrl;
302313
303314 ctx.nameToUrl = function() {
304315 var url = origNameToUrl.apply(ctx, arguments);
@@ -317,6 +328,8 @@ public function getMinResolverCode()
317328 }
318329
319330 /**
331+ * Get map for given file.
332+ *
320333 * @param string $fileId
321334 * @param array $params
322335 * @return array
0 commit comments