magento / pwa-studio

šŸ› Development tools to build, optimize and deploy Progressive Web Applications for Magento 2.
https://developer.adobe.com/commerce/pwa-studio/
Open Software License 3.0
1.06k stars 682 forks source link

[bug]: Certain talons and hooks cannot be wrapped #3873

Closed justinconabree closed 1 year ago

justinconabree commented 2 years ago

Describe the bug

Peregrine exposes its talons and hooks based on the file name. If the talon or hook does not export a variable with the same name, wrapping causes the error below. There are a select few that export default instead of a named variable.

WARNING in ./node_modules/@magento/peregrine/lib/talons/ContactPage/useContactLink.js
    Module Warning (from ./node_modules/@magento/pwa-buildpack/lib/WebpackTools/loaders/wrap-esm-loader.js):
    (Emitted value instead of an instance of Error) wrap-js-loader: Cannot wrap export "useContactLink" of "/projects/rnd/pwastudio/pwastudio-accelerator/packages/accelerator/node_modules/@magento/peregrine/lib/talons/ContactPage/useContactLink.js" with module "src/talons/ContactPage/useContactLink.wrap" because it does not have an export named "useContactLink".

To reproduce

Steps to reproduce the behavior:

  1. Using targets, wrap one of the talons that exports default instead of a named variable
  2. Run build
  3. Error thrown

Expected behavior

No error thrown for any talon or hook

Possible solutions

Export named variables across all talons and hooks

Please let us know what packages this bug is in regards to:

m2-assistant[bot] commented 2 years ago

Hi @JustinConabreeAbsolunet. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information.

Add a comment to assign the issue: @magento I am working on this


justinconabree commented 2 years ago

@magento I am working on this

m2-assistant[bot] commented 2 years ago

Hi @JustinConabreeAbsolunet! :wave: Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team command to join Contributors team.

justinconabree commented 2 years ago

@magento add to contributors team

m2-assistant[bot] commented 2 years ago

Hi @JustinConabreeAbsolunet! :wave: Thank you for joining. Please accept team invitation :point_right: here :point_left: and add your comment one more time.

justinconabree commented 2 years ago

@magento add to contributors team

anthoula commented 2 years ago

@magento export issue to JIRA project PWA as Bug

github-jira-sync-bot commented 2 years ago

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/PWA-2899 is successfully created for this GitHub issue.