query-selector-shadow-dom icon indicating copy to clipboard operation
query-selector-shadow-dom copied to clipboard

Error "cannot use import statement outside a module" with React

Open thisistaimur opened this issue 4 years ago • 7 comments
trafficstars

Getting an error when importing the module into a React script. Same works fine in a Node app or plain HTML. Does anyone have a fix?

Screen Shot 2021-06-03 at 12 23 41 Screen Shot 2021-06-03 at 12 23 22

thisistaimur avatar Jun 03 '21 10:06 thisistaimur

This is because this module ships as native modules and the React ecoystem is some what legacy in this respect,

I've got a PR to try to address this but i havent had time to test it properly, and would need to be a breaking change.

https://github.com/Georgegriff/query-selector-shadow-dom/pull/53/files

If you want to experiment with this you should be able to change your package.json entry for this package to:

"query-selector-shadow-dom": "git://Georgegriff/query-selector-shadow-dom.git#consider_essm"

If you have any time to help contribute/test t would be appreciated

Georgegriff avatar Jun 03 '21 10:06 Georgegriff

Cheers, will look into it and definitely contribute if I come up with a solution :)

thisistaimur avatar Jun 03 '21 19:06 thisistaimur

Did this solution get implemented? Is there a fork that can be used instead?

Thanks!

JohnHardy avatar Mar 17 '22 12:03 JohnHardy

There isn't I would be open to contributions I started a pr but didn't get around to following it up, not sure when I will next get a chance to investigate https://github.com/Georgegriff/query-selector-shadow-dom/pull/53

Georgegriff avatar Mar 17 '22 16:03 Georgegriff

Thanks for your time following up with me - I really appreciate it. Sorry, I thought the PR above was fully finished.

JohnHardy avatar Mar 17 '22 17:03 JohnHardy

This is because this module ships as native modules and the React ecoystem is some what legacy in this respect,

I've got a PR to try to address this but i havent had time to test it properly, and would need to be a breaking change.

https://github.com/Georgegriff/query-selector-shadow-dom/pull/53/files

If you want to experiment with this you should be able to change your package.json entry for this package to:

"query-selector-shadow-dom": "git://Georgegriff/query-selector-shadow-dom.git#consider_essm"

If you have any time to help contribute/test t would be appreciated

Could you tell me the mean of "change your package.json entry"?

kazaff avatar Aug 29 '22 06:08 kazaff

Bump on this -- also running into this issue!

jiefugong avatar Dec 02 '22 21:12 jiefugong