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
The common bundle and a page-special bundle are in front of requirejs-config.js after building. For this situation, there are many systax errors on checkout page, and mixins config of requirejs do not work.
Possible solutions:
Requirejs configuration should be loaded and executed before other modules with AMD by reference to Requirejs API and Require Optimizer. Besides, our code depend on polyfill.js and requirejs-mixins.js and so on. So, a page-special bundle should be placed at the end of head tag.
I modified the function _prepareLayout() in Magento_BundleConfig/Block/Html/Head/Config.php. It works.
if (file_exists($pageSpecificBundleAbsPath)) {
$assetCollection->add(
$pageSpecificBundleRelPath,
$bundleConfig
);
}
The text was updated successfully, but these errors were encountered:
The shared bundle should also be loaded after mage/requirejs/mixins.js and requirejs-config.js. So I fixed this in Magento_BundleConfig/Block/Html/Head/Config.php by replacing:
if (file_exists($sharedBundleAbsPath)) {
$assetCollection->insert(
$sharedBundleRelPath,
$shared,
RequireJsConfig::REQUIRE_JS_FILE_NAME
);
}
by
if (file_exists($sharedBundleAbsPath)) {
$assetCollection->add(
$sharedBundleRelPath,
$shared
);
}
Which places both the shared and the page-specific bundles after the aforementioned JS files.
kweij
pushed a commit
to kweij/m2-devtools
that referenced
this issue
Jan 23, 2020
Instead of inserting the bundles directly after `requirejs/require`, append the bundles using `add`. This causes the bundles to be loaded after 2 important files that need to be loaded before these bundles: `requirejs-config` and `mage/requirejs/mixins`.
This fixes issue magento#57
This issue is a:
Description
The common bundle and a page-special bundle are in front of requirejs-config.js after building. For this situation, there are many systax errors on checkout page, and mixins config of requirejs do not work.
Possible solutions:
Requirejs configuration should be loaded and executed before other modules with AMD by reference to Requirejs API and Require Optimizer. Besides, our code depend on polyfill.js and requirejs-mixins.js and so on. So, a page-special bundle should be placed at the end of head tag.
I modified the function _prepareLayout() in Magento_BundleConfig/Block/Html/Head/Config.php. It works.
The text was updated successfully, but these errors were encountered: