Issue
I want to use reactDOM for injecting content to page. So, I want to
import React from 'react';
...
import App from './src/js/App';
const root=createRoot(document.getElementById('title'));
root.render(
<App/>
);
included into my background.js but I get the following error: SyntaxError: Cannot use import statement outside a module
Import that is causing the error:
import React from 'react'
I've done some research and tried adding type: "module" but that does not work.
What can I do to solve this?
Solution
After many research,
I did npm run eject
here is the working react setup
https://github.com/rba1aji/chrome-extension-template-react
Answered By - Balaji Answer Checked By - Robin (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.