pwa-studio icon indicating copy to clipboard operation
pwa-studio copied to clipboard

[bug]: Certain talons and hooks cannot be wrapped

Open justinconabree opened this issue 2 years ago • 8 comments

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:

  • [ ] venia-concept
  • [x] venia-ui
  • [ ] pwa-buildpack
  • [x] peregrine
  • [ ] pwa-devdocs
  • [ ] upward-js
  • [ ] upward-spec
  • [ ] create-pwa

justinconabree avatar Jun 01 '22 13:06 justinconabree

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


m2-assistant[bot] avatar Jun 01 '22 13:06 m2-assistant[bot]

@magento I am working on this

justinconabree avatar Jun 01 '22 13:06 justinconabree

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.

m2-assistant[bot] avatar Jun 01 '22 13:06 m2-assistant[bot]

@magento add to contributors team

justinconabree avatar Jun 01 '22 15:06 justinconabree

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

m2-assistant[bot] avatar Jun 01 '22 15:06 m2-assistant[bot]

@magento add to contributors team

justinconabree avatar Jun 01 '22 15:06 justinconabree

@magento export issue to JIRA project PWA as Bug

anthoula avatar Jun 06 '22 14:06 anthoula

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

github-jira-sync-bot avatar Jun 06 '22 14:06 github-jira-sync-bot