score:1

Accepted answer

it's not a react problem but rather a bundler issue. if you are using webpack, you need to have multiple entry points.

e.g.

entry: {
    popup: path.join('src', 'popup', 'index.js'),
    background: path.join('src', 'background', 'index.js'),
    content: path.join('src', 'content', 'index.js'),
},

inside your webpack.config.js.

if you are interested in boilerplate that provides this functionality, you can look at https://github.com/anilredshift/chrome-extension-webpack-boilerplate


Related Query

More Query from same tag