2

I have a small problem with cache in production files Mb someone know how i can specify custom name for js and css file in dist as like chunk-24545415.js?v=232315 Or b someone know some guide about this

1 Answers1

2

Take a look at Code Splitting and Magic Comments documentation.

In your webpack.config.js you can specify a format for the chunk filename.

module.exports = {
  //...
  output: {
    //...
    chunkFilename: '[id].js'
  }
};

Sadly, if you want a custom name for each chunk, the best solution I've found for Webpack is to use the Magic Comments.

Basically when you do an import, you put a special comment, specifying the name of the chunk.

 import(/* webpackChunkName: 'my-first-chunk' */ "./my-first-chunk.vue")

You also need to use [name] in the chunkFilename if you want to use magic comments.

chunkFilename: '[name].js'

Shoejep
  • 4,414
  • 4
  • 22
  • 26