vue - js,css打包时每次更新
vue.config.js
const name = defaultSettings.title || ""; // page title
//添加版本号 此处用时间戳
const Timestamp = new Date().getTime();
// 处理 css 时 引入MiniCssExtractPlugin
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
configureWebpack: {
// provide the app's title in webpack's name field, so that
// it can be accessed in index.html to inject the correct title.
name: name,
resolve: {
alias: {
"@": resolve("src")
}
},
plugins: [
new MiniCssExtractPlugin({
// 修改打包后css文件名
filename: `static/css/[name].${Timestamp}.css`,
chunkFilename: `static/css/[name].${Timestamp}.css`
})
],
output: {
// 输出重构 打包编译后的 文件名称 【模块名称.版本号.时间戳】
filename: `static/js/[name].${Timestamp}.js`,
chunkFilename: `static/js/[name].${Timestamp}.js`
}
},