Skip to content

JS files located outside the web/js directory #16302

Closed
@BenSpace48

Description

@BenSpace48

Summary

Some JS files are direct children of web rather than web/js. This does not follow instructions from the dev docs thus is confusing.

Place the custom component source file in one of the following locations:
Your theme JS files: /web/js or /_/web/js
Your module view JS files: <module_dir>/view/frontend/web/js

There are more instances of this:

  • vendor/magento/module-payment/view/frontend/web/transparent.js
  • vendor/magento/module-payment/view/frontend/web/cc-type.js
  • vendor/magento/module-search/view/frontend/web/form-mini.js
  • vendor/magento/module-sales/view/frontend/web/gift-message.js

There are more but I'm pushed for time at the minute.

Preconditions

  1. Magento 2.2 - This is irrelevant as it appears in all versions

Steps to reproduce

  1. Go to https://github.com/magento/magento2/tree/2.2-develop/app/code/Magento/Captcha/view/frontend/web and look where captcha.js and onepage.js is located.

Expected result

  1. JS files to be inside web/js as per the dev docs.

Actual result

  1. JS files are direct children of web, this is inconsistent with the dev docs.

This is confusing as the dev docs instructs developers to use certain locations yet the core does not follow this, either the files should be relocated to be inside web/js or the dev docs should be updated. Unless there is a valid reason why the files are outside web/js?

Metadata

Metadata

Labels

Component: Framework/CodeFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions