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]: RootComponents can't have // commented code in their files #2239

Open Jordaneisenburger opened 4 years ago

Jordaneisenburger commented 4 years ago

Describe the bug Leaving code comments in RootComponents/Category/category.js prevents webpack from running after a restart

To reproduce Steps to reproduce the behavior:

  1. Start watcher with yarn run watch:venia
  2. Go to packages/venia-ui/lib/RootComponents/Category/category.js
  3. comment out
    if (totalPagesFromData === null) { return fullPageLoadingIndicator; } with this // comment style
  4. Note that it seems to compile normally without errors
  5. Now restart the watcher
  6. It should give you an error like below Screenshot 2020-03-11 at 11 36 45
  7. Now go ahead and remove the piece of code that we've just commented.
  8. Restart watcher and note it now work properly

Expected behavior Run's without a problem when you comment code

Additional context It seem sto happen when the code has an if() statement in the code that's been commented. Now for the weirdest part: when you use multiline comments like /* */ the problem doesn't appear. So I think somewhere in the RootComponentsPlugin it somehow read's these comments

Please complete the following device information:

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

brendanfalkowski commented 4 years ago

@Jordaneisenburger I was just about to add some notes here.

We hit the same bug around April and again in September, and needed @zetlen to lend an eye to understand it. It's the directive parser for root components that trips up expecting (if I recall correctly) a single comment block only which contains the "type" information.

awilcoxa commented 4 years ago

Created in Jira backlog for grooming/prioritization

awilcoxa commented 4 years ago

Marked as P3S3 given available workaround (@zetlen)

ericerway commented 3 years ago

@Jordaneisenburger can you confirm if this has been fixed in 8.0.0? Let's close if needed. Thanks!

Jordaneisenburger commented 3 years ago

Looks like it's fixed, I'll close for now.

spencer1573 commented 3 years ago

I can confirm that this issue is not fixed. see # 2957

Jordaneisenburger commented 2 years ago

The issue doesn't seem to be resolved, we're running pwa studio 12.2