V
V
VegasChickiChicki2020-01-19 20:51:30
webpack
VegasChickiChicki, 2020-01-19 20:51:30

How to configure webpack html plugin correctly?

I can't figure out how the cashe option in the html webpack plugin works . The main documentation says:

cache | {Boolean} | true | Emit the file only if it was changed

According to the description, it is clear that these pages should be updated only if they have changed, but in fact, all pages are rebuilt.
The plugin is connected as follows:
const HtmlWebpackPlugin = require('html-webpack-plugin');

const PAGES_DIR = `${baseWebpackConfig.externals.paths.src}/html`;
const PAGES = fs.readdirSync(PAGES_DIR).filter(fileName => fileName.endsWith('.html'));

plugins: [
   ...PAGES.map(page => new HtmlWebpackPlugin({
      cache: true,
      template: `${PAGES_DIR}/${page}`,
      filename: `./${page}`
    })),
]

I can't understand what's the matter, either I didn't quite understand how this option works, or I'm connecting something wrong...
PS will be when the pages will be 5-10, and 25-50 ...

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