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

gulp dev, how to change host for assets? #154

Closed
ograycode opened this issue Feb 7, 2017 · 2 comments
Closed

gulp dev, how to change host for assets? #154

ograycode opened this issue Feb 7, 2017 · 2 comments

Comments

@ograycode
Copy link
Contributor

ograycode commented Feb 7, 2017

I'm developing remotely, so nothing is being run from localhost. Because of this, I need to be able to get the assets from the remote server but the css/js is setting the host as localhost in the url. How can I change this?

I tried:

HOST=$(curl ipinfo.io/ip) HOST_IP=$(curl ipinfo.io/ip) gulp dev

However, on build it is like this in the html:

<link rel="stylesheet" href="http://127.0.0.1:2992/js/main.style.css">
<script src="http://127.0.0.1:2992/js/main.bundle.dev.js"></script>

I think this is the same issue as electrode-io/electrode-server#5

@ograycode
Copy link
Contributor Author

I was able to solve this by making the following changes in node_modules. Will most likely follow up with a PR later.

electrode-archetype-react-app/config/archetype.js

    webpack: Object.assign({}, {
      devHostname: process.env.WEBPACK_HOST || "localhost", //changed
      devPort: getInt(process.env.WEBPACK_DEV_PORT, 2992),
      testPort: getInt(process.env.WEBPACK_TEST_PORT, 3001),
      modulesDirectories: []
    }, archetypeOptions.webpack),

electrode-archetype-react-app/arch-gulpfile.js

    "wds.dev": {
      desc: "Start webpack-dev-server in dev mode",
      task: mkCmd("webpack-dev-server",
        `--config ${config.webpack}/webpack.config.dev.js`,
        `--progress --colors`,
        `--port ${archetype.webpack.devPort}`,
        `--host ${archetype.webpack.devHostname}`) //added
    },

electrode-react-webapp/react-webapp.js

  const pluginOptionsDefaults = {
    pageTitle: "Untitled Electrode Web Application",
    webpackDev: process.env.WEBPACK_DEV === "true",
    renderJS: true,
    serverSideRendering: true,
    htmlFile: Path.join(__dirname, "index.html"),
    devServer: {
      host: process.env.WEBPACK_HOST || "127.0.0.1", //changed
      port: "2992"
    },
    paths: {},
    stats: "dist/server/stats.json",
    iconStats: "dist/server/iconstats.json",
    criticalCSS: "dist/js/critical.css",
    buildArtifacts: ".build"
  };

@ograycode
Copy link
Contributor Author

This is resolved now

aweary pushed a commit to aweary/electrode that referenced this issue Feb 24, 2017
RFC: output flow declaration files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant