Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request: Way to support developing chrome extension #2017

Closed
JasonGoemaat opened this issue Apr 22, 2017 · 2 comments
Closed

request: Way to support developing chrome extension #2017

JasonGoemaat opened this issue Apr 22, 2017 · 2 comments

Comments

@JasonGoemaat
Copy link

JasonGoemaat commented Apr 22, 2017

I want to write pages in my extension (served with the extension) using react. Right now I have to save my file, switch to command line and do a build (20s), then copy the folder to my extension directory. I was hoping I could just use 'npm start' with the live re-build. However when I try to load the script I get a CORS error. Adding 'content_security_policy' allows me to load it, but there is an error opening chrome-extension:<my-id>/sockjs-node and the script stops executing.

Is there a way to either disable this (with or without ejecting) or to have a 'build' that watches for changes and produces actual output files that I could serve myself? Refreshing the page after a change isn't an issue for me, I just don't want to switch to the console and wait 20 seconds for a full production build...

@JasonGoemaat
Copy link
Author

If I can get the bundle to override the sockjs location like this it would be perfect:

// Connect to WebpackDevServer via a socket.
var connection = new SockJS(url.format({
  // protocol: window.location.protocol,
  // hostname: window.location.hostname,
  // port: window.location.port, 
  protocol: 'http',
  hostname: 'localhost',
  port: 3000,
  // Hardcoded in WebpackDevServer
  pathname: '/sockjs-node'
}));

I think I can get it working for now writing a proxy to intercept the script and change it, just one more thing to run..

@Timer
Copy link
Contributor

Timer commented Apr 23, 2017

You will be able to do this if #1588 gets merged, which supports specifying the HOST and PORT env var.

I'm going to close this as a duplicate. Please follow #1588 for updates.

@Timer Timer closed this as completed Apr 23, 2017
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants