0

I ran into such a problem that I can not implement the react in the content.js file. For those who do not know when creating an extension for chrome there is a pop-up window, this is a window in the corner on the right, content.js is a file that allows you to interact with the DOM. What should be done to inject React into this file?

Error after inject React into content.js:

Content.js:

wOxxOm
  • 65,848
  • 11
  • 132
  • 136
  • Isn't that some nodeJS code? don't you have to write some client javascript? I don't know that tech, but it looks like your trying to run nodejs code into plain javascript... ? – MathieuAuclair Feb 19 '21 at 14:33
  • 1
    Sounds like your webpack config should be tweaked to generate a single bundle so there'll be no need for imports in the output code. Alternatively, there's an ugly workaround which I don't recommend: [How to import ES6 modules in content script for Chrome Extension](https://stackoverflow.com/q/48104433) – wOxxOm Feb 19 '21 at 14:42
  • @MathieuAuclair, it's a React Syntax. I trying create some div, and append it in page. And then - render all components inside Default react – Дмитрий Кузяев Feb 19 '21 at 15:04
  • Cool I didn't know, good to know :) – MathieuAuclair Feb 19 '21 at 15:05

0 Answers0