jhen0409 / react-chrome-extension-boilerplate

Boilerplate for Chrome Extension React.js project
MIT License
2.14k stars 388 forks source link

Chrome extension doesn't work in dev mode #54

Closed lightninglu10 closed 7 years ago

lightninglu10 commented 7 years ago

Hey guys, I'm trying to run the chrome extension in dev mode.

I've done everything the instructions say, and everything works EXCEPT the todo app.

When I load the production version with npm run build, I get the todo app, but when I do npm run dev and load the dev folder, the todo app is blank.

Attaching images below. Any idea why?

screen shot 2016-11-12 at 3 22 41 pm screen shot 2016-11-12 at 3 22 36 pm
lightninglu10 commented 7 years ago

Also, unrelated but is there anyway to connect the inject.js through redux with the app components? Getting stumped there. I want to pass data I'm getting through inject.js to the App.js components.

jhen0409 commented 7 years ago

Hi @lightninglu10, thanks for report!

I'm found the problem, it looks related to redux-devtools-extension if you're installed:

2016-11-13 4 39 54

/cc @zalmoxisus

lightninglu10 commented 7 years ago

Is the solution for now to remove the redux-dev-tools portion?

jhen0409 commented 7 years ago

You can remove popup.pug#L12-L13 first (and window, inject), and check it work.

jhen0409 commented 7 years ago

Ah, just my fault, I missing object here, I'll fix it. 😂

lightninglu10 commented 7 years ago

@jhen0409

Bringing this up again:

"Also, unrelated but is there anyway to connect the inject.js through redux with the app components? Getting stumped there. I want to pass data I'm getting through inject.js to the App.js components."

Would you know how to do this?

jhen0409 commented 7 years ago

Also, unrelated but is there anyway to connect the inject.js through redux with the app components? Getting stumped there. I want to pass data I'm getting through inject.js to the App.js components.

Currently the inject page used iframe for CSS isolation, but pass data to App container will be difficult (may use postMessage of iframe or background), so it's not a good example.

Actually I'm Investigating ReactShadow to replace iframe, just not enough time.

lightninglu10 commented 7 years ago

If I don't care for CSS isolation, can I just import the component directly into the inject page?

jhen0409 commented 7 years ago

@lightninglu10 yeah, just replace here.