AccordBox / python-webpack-boilerplate

Django Webpack boilerplate & Flask Webpack boilerplate
https://python-webpack-boilerplate.rtfd.io
MIT License
167 stars 20 forks source link

Problem with `webpack-cli` & Live Reload Feature #28

Closed FilipWozniak closed 2 years ago

FilipWozniak commented 2 years ago

I followed the instructions about live reloading (reading "Live Reload" chapter) whilst trying to implement that feature in brand new Django/Wagtail/Vue/Webpack applications, but after executing npm run start, I keep getting the same error message.

image

devServer: {
  host: "0.0.0.0",
  port: 9091,
  headers: {
      "Access-Control-Allow-Origin": "*",
  },
  writeToDisk: true,
  watchFiles: [
      Path.join(__dirname, '../../gphn/**/*.py'),
      Path.join(__dirname, '../../gphn/**/*.html'),
  ]
}

System: MacOS Monterey Version of npm: 8.1.2 Version of Node: 16.13.2

"webpack": "^5.50.0",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^3.11.2"

Am I overlooking something very obvious?

michael-yin commented 2 years ago

@FilipWozniak

Please try to remove writeToDisk and watchFiles and see if it works.

Some config might vary in different Webpack related packages.

Thx.

michael-yin commented 2 years ago

@FilipWozniak

I just checked this issue on my local env.

Please upgrade to "webpack-dev-server": "^4.7.2"

And then use config below

  devServer: {
    host: "0.0.0.0",
    port: 9091,
    headers: {
      "Access-Control-Allow-Origin": "*",
    },
    devMiddleware: {
      writeToDisk: true,
    },
    watchFiles: [
      Path.join(__dirname, '../../django_app/**/*.py'),
      Path.join(__dirname, '../../django_app/**/*.html'),
    ],
  },
FilipWozniak commented 2 years ago

@michael-yin

It works like a charm! Thank you very much 🙂

I still can't believe that it took you less than half an hour... 😉