From 9b0c2bedc57ba6862cb79e09e5651a5cdb1a1311 Mon Sep 17 00:00:00 2001 From: liugongyu <290219706@qq.com> Date: Tue, 3 May 2022 12:20:42 +0800 Subject: [PATCH] 去缓存 --- build/webpack.base.conf.js | 4 +--- build/webpack.prod.conf.js | 7 ++++--- dist.zip | Bin 268403 -> 0 bytes index.html | 9 +++++---- package-lock.json | 17 +++++++++++++++++ package.json | 1 + vue.config.js | 9 ++++++++- 7 files changed, 36 insertions(+), 11 deletions(-) diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js index a07e683..0455e83 100644 --- a/build/webpack.base.conf.js +++ b/build/webpack.base.conf.js @@ -12,9 +12,7 @@ function resolve (dir) { module.exports = { context: path.resolve(__dirname, '../'), - entry: { - app: './src/main.js' - }, + entry: ['babel-polyfill', './src/main.js'], output: { path: config.build.assetsRoot, filename: '[name].js', diff --git a/build/webpack.prod.conf.js b/build/webpack.prod.conf.js index 34c64e4..898deba 100644 --- a/build/webpack.prod.conf.js +++ b/build/webpack.prod.conf.js @@ -12,7 +12,8 @@ const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') const UglifyJsPlugin = require('uglifyjs-webpack-plugin') const env = require('../config/prod.env') -const Version = new Date().getTime() + +const Version = new Date().getTime(); const webpackConfig = merge(baseWebpackConfig, { module: { rules: utils.styleLoaders({ @@ -25,8 +26,8 @@ const webpackConfig = merge(baseWebpackConfig, { output: { publicPath: './', path: config.build.assetsRoot, - filename: utils.assetsPath('js/[name].[chunkhash].js'), - chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') + filename: utils.assetsPath('js/[name].[chunkhash]'+Version+'.js'), + chunkFilename: utils.assetsPath('js/[id].[chunkhash]'+Version+'.js') }, plugins: [ // http://vuejs.github.io/vue-loader/en/workflow/production.html diff --git a/dist.zip b/dist.zip index 1e29288..0f8a8da 100644 Binary files a/dist.zip and b/dist.zip differ diff --git a/index.html b/index.html index b7c3389..ce154de 100644 --- a/index.html +++ b/index.html @@ -4,10 +4,11 @@ - - - - + + + + + 小票码扫码支付 diff --git a/package-lock.json b/package-lock.json index 9483e8f..91ba7f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1073,6 +1073,23 @@ "esutils": "^2.0.2" } }, + "babel-polyfill": { + "version": "6.26.0", + "resolved": "https://registry.npmmirror.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz", + "integrity": "sha512-F2rZGQnAdaHWQ8YAoeRbukc7HS9QgdgeyJ0rQDd485v9opwuPvjpPFcOOT/WmkKTdgy9ESgSPXDcTNpzrGr6iQ==", + "requires": { + "babel-runtime": "^6.26.0", + "core-js": "^2.5.0", + "regenerator-runtime": "^0.10.5" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.10.5", + "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", + "integrity": "sha512-02YopEIhAgiBHWeoTiA8aitHDt8z6w+rQqNuIftlM+ZtvSl/brTouaU7DW6GO/cHtvxJvS4Hwv2ibKdxIRi24w==" + } + } + }, "babel-preset-env": { "version": "1.7.0", "resolved": "https://registry.npm.taobao.org/babel-preset-env/download/babel-preset-env-1.7.0.tgz?cache=0&sync_timestamp=1591204557603&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbabel-preset-env%2Fdownload%2Fbabel-preset-env-1.7.0.tgz", diff --git a/package.json b/package.json index 8b6865f..f09313f 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ }, "dependencies": { "axios": "^0.21.1", + "babel-polyfill": "^6.26.0", "css-loader": "^3.6.0", "element-ui": "^2.15.1", "js-base64": "^3.6.0", diff --git a/vue.config.js b/vue.config.js index 8ab7693..6cab78b 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1 +1,8 @@ -module.exports = {chainWebpack:config=>{    config.rule('js').include.add(/node_modules\/(dom7|swiper)\/.*/)  }} +//vue.config.js +configureWebpack: config => { + const timeStamp = new Date().getTime(); + if (process.env.NODE_ENV === 'production') { + config.output.filename = `[name].${process.env.VUE_APP_VERSION}.${timeStamp}.js`; + config.output.chunkFilename = `[name].${process.env.VUE_APP_VERSION}.${timeStamp}.js`; + } +}, -- libgit2 0.21.4