Commit 9b0c2bedc57ba6862cb79e09e5651a5cdb1a1311
1 parent
b66e3bde
去缓存
Showing
7 changed files
with
36 additions
and
11 deletions
build/webpack.base.conf.js
| @@ -12,9 +12,7 @@ function resolve (dir) { | @@ -12,9 +12,7 @@ function resolve (dir) { | ||
| 12 | 12 | ||
| 13 | module.exports = { | 13 | module.exports = { |
| 14 | context: path.resolve(__dirname, '../'), | 14 | context: path.resolve(__dirname, '../'), |
| 15 | - entry: { | ||
| 16 | - app: './src/main.js' | ||
| 17 | - }, | 15 | + entry: ['babel-polyfill', './src/main.js'], |
| 18 | output: { | 16 | output: { |
| 19 | path: config.build.assetsRoot, | 17 | path: config.build.assetsRoot, |
| 20 | filename: '[name].js', | 18 | filename: '[name].js', |
build/webpack.prod.conf.js
| @@ -12,7 +12,8 @@ const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') | @@ -12,7 +12,8 @@ const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') | ||
| 12 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin') | 12 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin') |
| 13 | 13 | ||
| 14 | const env = require('../config/prod.env') | 14 | const env = require('../config/prod.env') |
| 15 | -const Version = new Date().getTime() | 15 | + |
| 16 | +const Version = new Date().getTime(); | ||
| 16 | const webpackConfig = merge(baseWebpackConfig, { | 17 | const webpackConfig = merge(baseWebpackConfig, { |
| 17 | module: { | 18 | module: { |
| 18 | rules: utils.styleLoaders({ | 19 | rules: utils.styleLoaders({ |
| @@ -25,8 +26,8 @@ const webpackConfig = merge(baseWebpackConfig, { | @@ -25,8 +26,8 @@ const webpackConfig = merge(baseWebpackConfig, { | ||
| 25 | output: { | 26 | output: { |
| 26 | publicPath: './', | 27 | publicPath: './', |
| 27 | path: config.build.assetsRoot, | 28 | path: config.build.assetsRoot, |
| 28 | - filename: utils.assetsPath('js/[name].[chunkhash].js'), | ||
| 29 | - chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') | 29 | + filename: utils.assetsPath('js/[name].[chunkhash]'+Version+'.js'), |
| 30 | + chunkFilename: utils.assetsPath('js/[id].[chunkhash]'+Version+'.js') | ||
| 30 | }, | 31 | }, |
| 31 | plugins: [ | 32 | plugins: [ |
| 32 | // http://vuejs.github.io/vue-loader/en/workflow/production.html | 33 | // http://vuejs.github.io/vue-loader/en/workflow/production.html |
dist.zip
No preview for this file type
index.html
| @@ -4,10 +4,11 @@ | @@ -4,10 +4,11 @@ | ||
| 4 | <meta charset="utf-8"> | 4 | <meta charset="utf-8"> |
| 5 | <meta name="google" content="notranslate"> | 5 | <meta name="google" content="notranslate"> |
| 6 | <meta name="viewport" content="width=device-width,initial-scale=1.0"> | 6 | <meta name="viewport" content="width=device-width,initial-scale=1.0"> |
| 7 | - <meta http-equiv="pragma" content="no-cache" /> | ||
| 8 | - <meta http-equiv="content-type" content="no-cache, must-revalidate" /> | ||
| 9 | - <meta http-equiv="Cache-Control" content="no-cache, must-revalidate" /> | ||
| 10 | - <meta http-equiv="expires" content="Wed, 26 Feb 2000 11:22:33 GMT"/> | 7 | + <!-- 在入口文件index.html中,头部添加meta标签 --> |
| 8 | + <meta http-equiv="Expires" content="0"> | ||
| 9 | + <meta http-equiv="Pragma" content="no-cache"> | ||
| 10 | + <meta http-equiv="Cache-control" content="no-cache"> | ||
| 11 | + <meta http-equiv="Cache" content="no-cache"> | ||
| 11 | <title>小票码扫码支付</title> | 12 | <title>小票码扫码支付</title> |
| 12 | </head> | 13 | </head> |
| 13 | <body> | 14 | <body> |
package-lock.json
| @@ -1073,6 +1073,23 @@ | @@ -1073,6 +1073,23 @@ | ||
| 1073 | "esutils": "^2.0.2" | 1073 | "esutils": "^2.0.2" |
| 1074 | } | 1074 | } |
| 1075 | }, | 1075 | }, |
| 1076 | + "babel-polyfill": { | ||
| 1077 | + "version": "6.26.0", | ||
| 1078 | + "resolved": "https://registry.npmmirror.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz", | ||
| 1079 | + "integrity": "sha512-F2rZGQnAdaHWQ8YAoeRbukc7HS9QgdgeyJ0rQDd485v9opwuPvjpPFcOOT/WmkKTdgy9ESgSPXDcTNpzrGr6iQ==", | ||
| 1080 | + "requires": { | ||
| 1081 | + "babel-runtime": "^6.26.0", | ||
| 1082 | + "core-js": "^2.5.0", | ||
| 1083 | + "regenerator-runtime": "^0.10.5" | ||
| 1084 | + }, | ||
| 1085 | + "dependencies": { | ||
| 1086 | + "regenerator-runtime": { | ||
| 1087 | + "version": "0.10.5", | ||
| 1088 | + "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", | ||
| 1089 | + "integrity": "sha512-02YopEIhAgiBHWeoTiA8aitHDt8z6w+rQqNuIftlM+ZtvSl/brTouaU7DW6GO/cHtvxJvS4Hwv2ibKdxIRi24w==" | ||
| 1090 | + } | ||
| 1091 | + } | ||
| 1092 | + }, | ||
| 1076 | "babel-preset-env": { | 1093 | "babel-preset-env": { |
| 1077 | "version": "1.7.0", | 1094 | "version": "1.7.0", |
| 1078 | "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", | 1095 | "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", |
package.json
| @@ -11,6 +11,7 @@ | @@ -11,6 +11,7 @@ | ||
| 11 | }, | 11 | }, |
| 12 | "dependencies": { | 12 | "dependencies": { |
| 13 | "axios": "^0.21.1", | 13 | "axios": "^0.21.1", |
| 14 | + "babel-polyfill": "^6.26.0", | ||
| 14 | "css-loader": "^3.6.0", | 15 | "css-loader": "^3.6.0", |
| 15 | "element-ui": "^2.15.1", | 16 | "element-ui": "^2.15.1", |
| 16 | "js-base64": "^3.6.0", | 17 | "js-base64": "^3.6.0", |
vue.config.js
| 1 | -module.exports = {chainWebpack:config=>{ config.rule('js').include.add(/node_modules\/(dom7|swiper)\/.*/) }} | 1 | +//vue.config.js |
| 2 | +configureWebpack: config => { | ||
| 3 | + const timeStamp = new Date().getTime(); | ||
| 4 | + if (process.env.NODE_ENV === 'production') { | ||
| 5 | + config.output.filename = `[name].${process.env.VUE_APP_VERSION}.${timeStamp}.js`; | ||
| 6 | + config.output.chunkFilename = `[name].${process.env.VUE_APP_VERSION}.${timeStamp}.js`; | ||
| 7 | + } | ||
| 8 | +}, |