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

3

1 Answer 1

3

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'

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.