-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Making Webpacker run on Cloud 9 #176
Comments
@BigChief45 I think this PR will fix the problem - #153 |
@BigChief45 are you able to test Gaurav's PR on cloud9? You will need to run it on a fresh app with `gem 'webpacker', github: 'gauravtiwari/webpacker', branch: 'feature/static-assets' because this PR has some structural changes. Follow the instruction here #153 After you are done, you can change the host and port at |
The PR is now merged so, you can try this out using master -
|
You could set |
I did that but it seems that I also had to add |
right, so it seems we might need to add a configuration for protocol too. |
@BigChief45 can you confirm that it works after you add |
@ytbryan I am trying to. Browser console does not show any messages anymore, but I still cannot get Vue to work. I am running webpack dev server in My view code is the following: <h1>Home#index</h1>
<p>Find me in app/views/home/index.html.erb</p>
<div id="hello">
</div>
<%= javascript_pack_tag 'application' %>
<%= javascript_pack_tag 'hello_vue' %> However, the only thing that is rendered is the default I took a look at the requests in the console and found this: |
You are still using You need to put your Cloud 9 hostname as Public Path, the same one as you use for Rails (the one hidden in your screenshot) but on port 8080 (not 8081, which is the port Rails is using). |
@renchap I am aware of that. But as far as I know, Cloud 9 only allows usage of the If I put the hostname hidden from the screenshot into the
|
@BigChief45 Yes Perhaps, you may consider closing this issue, since this isn't a problem with the gem, but rather a platform specific configuration problem. The gem out-of-the box provides the features needed to make |
@gauravtiwari Yes I was afraid of this. I think I will proceed to close this issue, but I might keep trying to find a way around this. By the way, can you explain the difference between the webpack dev server and the watcher? |
@BigChief45 you are read this #179 |
@gauravtiwari @ytbryan Thanks for all the help guys. I will close this issue now, hopefully I can make this work in the future. |
I'm not sure if OP was able to make it work or not. I was able to make webpack-dev-server work on Cloud 9 when run it as @gauravtiwari I see you mentioned adding configuration for protocol to accommodate https
Will you accept PR with this change? |
@ssemakov I have followed your advice but it did not work for me. I cant use webpack-dev-server in Cloudd 9. Webpack in watch mode works. |
@ssemakov @pelx Hello everyone I did manage to make this work. However since webpacker has changed a lot since this issue was opened, the way about to make this work is a bit simpler now: 1. Update
|
@BigChief45 thank you. First of all I did not have /etc/hosts. I created the file and the folder in the application root directory and added $C9_HOSTNAME. I guess /etc/hosts is system folder and not visible. GET https://0.0.0.0:8081/packs/application.css net::ERR_EMPTY_RESPONSE If I have a host and a port parameters in webpacker.yml file why Cloud 9 complains if I run webpack-dev-server without parameters?? I am giving up on webpack-dev-server and probably on webpacker gem too. I can use webpack and Rails without a "middleman". 40 years ago I would spent 1% on configuration and 99% coding. Now I spent 99% on configuration. regards |
Running cat /etc/hosts` If you can share the contents of your I suggest you give it one more try in a fresh new blank workspace. |
@BigChief45 you made me smile :) this is the yml. extensions: development: dev_server: test: public_output_path: packs-test production: this is what I got after I added one row: laris:~/workspace/shine (master) $ cat |
@BigChief45
and add
|
My step by step guide for Ruby on Rails 5.1.x and webpacker (master version 265a54d)
=> You can now check if it's working under: (note: httpS)
You should see some javascript
PLEASE comment if you've found a solution without the "mixed content" problem |
I was able to get this work in Rails 5.0 with @ssemakov 's initial solution combined with @BigChief45's hostname command run: then run: in chrome browser:
webpacker.yml looks like:
thanks both |
thanks a ton everyone for keeping this thread up to date ❤️ |
I'm getting the following error on running ./bin/webpack-dev-server --public '$C9_HOSTNAME'. Any ideas? "Invalid configuration object. webpack-dev-server has been initialised using a configuration object that does not match the API schema.
|
Also, echo "0.0.0.0 $C9_HOSTNAME" | sudo tee -a /etc/hosts needs to be ran on every workspace restart. Is there a solution to this or are you changing the hosts file on every session? |
oanstein, your solution works but the problem with Mixed content remains. |
Thanks to all the commenters here! I finally got this working! 😅🎉 To continue maintaining this thread with updated information, here is the tl;dr version of my approach, building up on the solutions above:
Now running as usual The full details of this solution and a slightly more involved but flexible approach ended up being a bit too long for a comment here, and I wrote them in this article for future reference. Edit (25nov2017)As noted by @ssemakov in #1033 (comment), now the |
Thanks @rbf for sharing. If you have time, feel free to make a PR to add the article to docs please. |
Thanks @gauravtiwari.
|
A new article under docs:
I think it's fine, just mention that this is for 3.0.2 |
As previously discussed in PR #107, I am having trouble making webpack work with Rails in my development environment, which is Cloud 9.
The problem seems to be that Cloud 9 only allows the
0.0.0.0
interface and a few ports (8080, 8081, etc.).Basically, I am experiencing the same problem as in this issue. It seems fixed they problem by adding
webpack-dev-server/client?https://0.0.0.0:8080
as an entry point towebpack.config.js
. However, in the setup with Rails I am not sure where to go about in adding this modification, since I do not see anywebpack.config.js
file. I am assuming thatconfig/webpack/development.js
would be represent something similar though.The text was updated successfully, but these errors were encountered: