Giter VIP home page Giter VIP logo

Comments (7)

jchip avatar jchip commented on September 25, 2024

Hi, thank you for taking the time to try this out on cloud9. That is incredible.

The webpack-dev-server endpoints for the static files are only active and used when you are running with webpack-dev-server.

When you are running the server on its own, the server uses the inert plugin and the electrode-static-files decor https://github.com/electrode-io/electrode-static-paths#static-files to serve files at the port you configured in your config files.

from electrode-server.

chprome avatar chprome commented on September 25, 2024

Hi,

Thank you for your reply and for sharing work with the community !

In fact, I am using the dev mode.
From my cloud9 workspace, in a terminal I run :

gulp dev

And in the log I see :

[11:11:29] Using gulpfile ~/workspace/gulpfile.js
[11:11:29] Starting 'dev'...
[11:11:29] Starting '.webpack-dev'...
[11:11:29] Finished '.webpack-dev' after 145 μs
[11:11:29] Starting 'server-dev'...
[11:11:29] Starting 'server-watch-$deps$'...
[11:11:29] Starting '.init-bundle.valid.log'...
[11:11:29] Finished '.init-bundle.valid.log' after 1.63 ms
[11:11:29] Finished 'server-watch-$deps$' after 4.4 ms
[11:11:29] Starting 'server-watch'...
[11:11:29] Starting 'generate-service-worker'...
[11:11:29] Finished 'generate-service-worker' after 357 μs
[nodemon] 1.10.2
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: .etmp/bundle.valid.log /home/ubuntu/workspace/server/**/* /home/ubuntu/workspace/config/**/*
Entry point configuration is not found, using default entry point...
isomorphic-loader webpack plugin: removed existing config file
  0% compile http://localhost:2992/webpack-dev-server/
webpack result is served from http://localhost:2992/js/
content is served from /home/ubuntu/workspace
webpack bundle is now VALID 
webpack report is served from http://localhost:2992/reporter
[nodemon] restarting due to changes...
[nodemon] starting `node server/index.js`
staticPaths Plugin: static files path prefix "dist"

Hapi.js server running at http://<cloud9.workspace.host.name>:8081

This line in particular :

webpack result is served from http://localhost:2992/js/

I would like webpack to server the assets from http://<cloud9.workspace.host.name>:8081/js/

How can I achieve this ?

Thanks
Christophe

from electrode-server.

jchip avatar jchip commented on September 25, 2024

I see. At the moment the port 2992 can't be changed but I am planning to make a change to that. However, webpack-dev-server would have to listen on a different port than the main server for obvious reasons. Would that work for you?

The port is set here https://github.com/electrode-io/electrode-archetype-react-app/blob/master/config/archtype.js#L16.

Is there a reason you are running with webpack-dev-server like that?

from electrode-server.

chprome avatar chprome commented on September 25, 2024

It should work, thanks.
I want to use this port because cloud9 only allows ports 8080, 8081 & 8082 to be used.

Cheers,
Christophe

from electrode-server.

jchip avatar jchip commented on September 25, 2024

electrode-archetype-react-app 1.3.2 supports env WEBPACK_DEV_PORT, you can set that to the port you want.

from electrode-server.

chprome avatar chprome commented on September 25, 2024

Thanks jchip.

I had to make additional edits :

in node_modules/electrode-archetype-react-app/config/archetype.js :

webpack: {
    devHostname: "my-workspace.my-cloud9-username.c9users.io", // edit
    devPort: getInt(process.env.WEBPACK_DEV_PORT, 2992),
    testPort: getInt(process.env.WEBPACK_TEST_PORT, 3001),
    modulesDirectories: []
  },

It would be good to be able to set an env variable for the hostname aswel.

and in server/plugins/webapp/index.js :

const pluginOptionsDefaults = {
    pageTitle: "Untitled Electrode Web Application",
    webpackDev: process.env.WEBPACK_DEV === "true",
    renderJS: true,
    serverSideRendering: true,
    devServer: {
      host: "my-workspace.my-cloud9-username.c9users.io", //edit
      port: "8082" // edit
    },
    paths: {},
    stats: "dist/server/stats.json"
  };

Now webpack serves it at my-workspace.my-cloud9-username.c9users.io:8082 :

Entry point configuration is not found, using default entry point...
isomorphic-loader webpack plugin: removed existing config file
  0% compile http://localhost:8082/webpack-dev-server/
webpack result is served from http://my-workspace.my-cloud9-username.c9users.io:8082/js/
content is served from /home/ubuntu/workspace
webpack bundle is now VALID 

But the browser fail to get the resource (HTTP 503)
It think that it's on Cloud 9 side as it does not see the app running on port 8082

Cheers
Christophe

from electrode-server.

datvong-wm avatar datvong-wm commented on September 25, 2024

Close due to inactivity

from electrode-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.