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
Asked
Active
Viewed 1,034 times
2
-
2What build tool are you using? Webpack? – Shoejep Apr 19 '20 at 18:31
-
Have you looked here: https://stackoverflow.com/questions/55717783/any-webpack-splitchunks-name-as-a-function-documentation-other-than-from-the-web – Michael Apr 20 '20 at 04:48
-
Yes im using Webpack – Евгений Тимченко Apr 20 '20 at 05:59
1 Answers
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