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

[bug]: RootComponents can't have // commented code in their files

Open Jordaneisenburger opened this issue 4 years ago • 7 comments

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: 0. Start watcher with yarn run watch:venia

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

  • Device [e.g. iPhone6, PC, Mac, Pixel3]:
  • OS [e.g. iOS8.1, Windows 10]:
  • Browser [e.g. Chrome, Safari]:
  • Browser Version [e.g. 22]:
  • Magento Version:
  • PWA Studio Version:
  • NPM version npm -v:
  • Node Version node -v:

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

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

Jordaneisenburger avatar Mar 11 '20 10:03 Jordaneisenburger

@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.

brendanfalkowski avatar Mar 11 '20 18:03 brendanfalkowski

Created in Jira backlog for grooming/prioritization

awilcoxa avatar Mar 30 '20 17:03 awilcoxa

Marked as P3S3 given available workaround (@zetlen)

awilcoxa avatar Mar 30 '20 18:03 awilcoxa

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

ericerway avatar Nov 12 '20 15:11 ericerway

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

Jordaneisenburger avatar Nov 13 '20 09:11 Jordaneisenburger

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

spencer1573 avatar Jun 15 '21 19:06 spencer1573

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

Jordaneisenburger avatar Apr 28 '22 15:04 Jordaneisenburger