A
A
Andrey Frantsev2019-07-26 12:00:45
webpack
Andrey Frantsev, 2019-07-26 12:00:45

Building a static site. Why is the assembly in html not updated?

Good afternoon! I'm trying to set up compilation of ejs templates for a static site. The problem is that in dev mode, the assembly is rebuilt only when changes are made in the main template. If you change the files included in it (for example, header) in dev mode, the assembly is not rebuilt. Webpack not seeing changes?
template folder structure:

views
    pages
         index.ejs
    partials
        header.ejs

webpack config:
module.exports = {
  module: {
    rules: [
    {
      test: /\.ejs$/,
      use: {
        loader: 'ejs-templates-loader',
        options: {}
      }

    }]
  },
  plugins: [
    new HtmlWebpackPlugin ({
      template: './src/views/pages/index.ejs',
      filename: './index.html'
    })
  ],
}

index.ejs
<body>
    <h1>AAAAAAAAA</h1>
    <%- include('../partials/header.ejs', {test: 123311222}) -%>
</body>

header.ejs
<h2><%= test %></h2>
<h3>111222</h3>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question