2

I'm using Webpack 4 in a Multi Page Application.

When in development mode:

Each page have some common third-party libraries (loaded via <script> tag) plus a custom .js file per-page (entry point) generated by Webpack and only used in that page (i.e: page_users-script.js)

Issue I found is that if a have an html page with no javascript logic at all (404 error page, Contact page and so on...), if that page has NOT a .js file associated (webpack entry point), browser won't refresh when I change static content (pug template, styles...).

I worked around this issue creating an empty .js file for those pages without any logic, but I think this is not really acceptable. My current webpack config file is the following regarding devServer:

webpack.config.js

// https://webpack.js.org/concepts/entry-points/#multi-page-application
    entry: {
      ...names
    },

    // https://webpack.js.org/configuration/dev-server/
    devServer: {
      port: 8080,
      watchContentBase: true
    },
Barleby
  • 618
  • 2
  • 9
  • 20

0 Answers0