Skip to content

HMR / dev-server is not working inside a VM despite the documentation #277

@tristanbes

Description

@tristanbes

Hello,

We're facing a problem while trying to run HMR:

building with

/node_modules/.bin/encore dev-server --host 0.0.0.0 --port 8000 --disable-host-check --hot --public enigma.vm

accessing http://enigma.vm/login, the assets are trying to load from http://0.0.0.0:8000/build/login.css
but the local traffic is redirected on enigma.vm. so http://0.0.0.0:8000 does not answer.
yet, http://enigma.vm:8000/build/home.css serve the right asset.

When trying something different:

./node_modules/.bin/encore dev-server --host enigma.vm --port 8000 --disable-host-check --hot

The assets is correctly served from the server http://enigma.vm:8000/build/home.css

But when trying to access http://enigma.vm/login, then the assets are loaded from http://enigma.vm:8000/build/login.css which reply with net::ERR_CONNECTION_REFUSED

My frontend dev is 100% blaming webpack-encore, and say this would never happened running webpack without the wrapper. I'm sad because I was an advocate to encore.... help me prove him wrong ;-)

const Encore = require('@symfony/webpack-encore');

Encore
  .setOutputPath('public/build/')
  .setPublicPath('/build')
  .cleanupOutputBeforeBuild()
  .enableSourceMaps(!Encore.isProduction())
  .enableVersioning(Encore.isProduction())

  .addEntry('home', './assets/js/home/home.js')
  .addEntry('login', './assets/js/login/login.js')
  .enableVueLoader()
;

var config = Encore.getWebpackConfig();
config.watchOptions = { poll: 300, ignored: /node_modules/ };

module.exports = config;

PS i've read #126 thought it would help me, but it's not :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions