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
-
2What build tool are you using? Webpack?Shoejep– Shoejep2020-04-19 18:31:47 +00:00Commented Apr 19, 2020 at 18:31
-
Have you looked here: stackoverflow.com/questions/55717783/…Michael– Michael2020-04-20 04:48:28 +00:00Commented Apr 20, 2020 at 4:48
-
Yes im using WebpackЕвгений Тимченко– Евгений Тимченко2020-04-20 05:59:29 +00:00Commented Apr 20, 2020 at 5:59
Add a comment
|
1 Answer
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'