magento / magento/m2-devtools

systax error and mixins config do not work

Open
#57 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
171
Forks
47
PR merge metrics
No merged PRs in 30d

Description

This issue is a:

  • Bug
  • Feature suggestion
  • Documentation issue
  • Other (Please Specify)

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.

if (file_exists($pageSpecificBundleAbsPath)) {
            $assetCollection->add(
                $pageSpecificBundleRelPath,
                $bundleConfig
            );
        }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Magento_BundleConfig/Block/Html/Head/Config.php at _prepareLayout(), then inspect how RequireJS configuration and page-specific bundles are ordered in the head. Done means the configuration runs before AMD modules, the page-specific bundle is placed at the end of the head, and checkout has no syntax errors while RequireJS mixins work.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
build-system, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.