|
@@ -1,25 +1,25 @@
|
|
|
-"use strict";
|
|
|
|
|
-const path = require("path");
|
|
|
|
|
|
|
+'use strict'
|
|
|
|
|
+const path = require('path')
|
|
|
|
|
|
|
|
function resolve(dir) {
|
|
function resolve(dir) {
|
|
|
- return path.join(__dirname, dir);
|
|
|
|
|
|
|
+ return path.join(__dirname, dir)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const name = "微纳园"; // page title
|
|
|
|
|
|
|
+const name = '微纳园' // page title
|
|
|
|
|
|
|
|
-const ip = "0.0.0.0"; // dev port
|
|
|
|
|
-const port = 9528; // dev port
|
|
|
|
|
|
|
+const ip = '0.0.0.0' // dev port
|
|
|
|
|
+const port = 9525 // dev port
|
|
|
|
|
|
|
|
-const Webpack = require("webpack");
|
|
|
|
|
|
|
+const Webpack = require('webpack')
|
|
|
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
|
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
|
|
-const CompressionPlugin = require("compression-webpack-plugin");
|
|
|
|
|
|
|
+const CompressionPlugin = require('compression-webpack-plugin')
|
|
|
|
|
|
|
|
module.exports = {
|
|
module.exports = {
|
|
|
// publicPath: '/mnpH5/', // 代理模式使用
|
|
// publicPath: '/mnpH5/', // 代理模式使用
|
|
|
- publicPath: "/lifelineH5/", // tomcat模式使用
|
|
|
|
|
- outputDir: "dist",
|
|
|
|
|
- assetsDir: "assets",
|
|
|
|
|
- lintOnSave: process.env.NODE_ENV === "development",
|
|
|
|
|
|
|
+ publicPath: '/lifelineH5/', // tomcat模式使用
|
|
|
|
|
+ outputDir: 'dist',
|
|
|
|
|
+ assetsDir: 'assets',
|
|
|
|
|
+ lintOnSave: process.env.NODE_ENV === 'development',
|
|
|
productionSourceMap: false,
|
|
productionSourceMap: false,
|
|
|
devServer: {
|
|
devServer: {
|
|
|
open: true,
|
|
open: true,
|
|
@@ -30,22 +30,22 @@ module.exports = {
|
|
|
// 以上的ip和端口是我们本机的;下面为需要跨域的
|
|
// 以上的ip和端口是我们本机的;下面为需要跨域的
|
|
|
proxy: {
|
|
proxy: {
|
|
|
// 配置跨域
|
|
// 配置跨域
|
|
|
- "/h5Server": {
|
|
|
|
|
|
|
+ '/h5Server': {
|
|
|
|
|
|
|
|
- // target: `http://2.22.195.139:8080/apiForProd`,
|
|
|
|
|
- target: `http://lifeline.idea-sf.com/lifelineApi`,
|
|
|
|
|
|
|
+ target: `http://2.22.195.139:8781/apiForProd`,
|
|
|
|
|
+ // target: `http://lifeline.idea-sf.com/lifelineApi`,
|
|
|
ws: true,
|
|
ws: true,
|
|
|
changOrigin: true, // 允许跨域
|
|
changOrigin: true, // 允许跨域
|
|
|
pathRewrite: {
|
|
pathRewrite: {
|
|
|
- "^/h5Server": "" // 请求的时候使用这个server就可以
|
|
|
|
|
|
|
+ '^/h5Server': '' // 请求的时候使用这个server就可以
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- "/server": {
|
|
|
|
|
|
|
+ '/server': {
|
|
|
target: process.env.VUE_APP_API_URL,
|
|
target: process.env.VUE_APP_API_URL,
|
|
|
ws: true,
|
|
ws: true,
|
|
|
changOrigin: true, // 允许跨域
|
|
changOrigin: true, // 允许跨域
|
|
|
pathRewrite: {
|
|
pathRewrite: {
|
|
|
- "^/server": "" // 请求的时候使用这个server就可以
|
|
|
|
|
|
|
+ '^/server': '' // 请求的时候使用这个server就可以
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -56,15 +56,15 @@ module.exports = {
|
|
|
name: name,
|
|
name: name,
|
|
|
resolve: {
|
|
resolve: {
|
|
|
alias: {
|
|
alias: {
|
|
|
- "@": resolve("src")
|
|
|
|
|
|
|
+ '@': resolve('src')
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
externals: {
|
|
externals: {
|
|
|
- vue: "Vue",
|
|
|
|
|
- "vue-router": "VueRouter",
|
|
|
|
|
- axios: "axios",
|
|
|
|
|
- vant: "vant",
|
|
|
|
|
- moment: "moment"
|
|
|
|
|
|
|
+ vue: 'Vue',
|
|
|
|
|
+ 'vue-router': 'VueRouter',
|
|
|
|
|
+ axios: 'axios',
|
|
|
|
|
+ vant: 'vant',
|
|
|
|
|
+ moment: 'moment'
|
|
|
},
|
|
},
|
|
|
plugins: [
|
|
plugins: [
|
|
|
// new BundleAnalyzerPlugin({ // 插件在这里使用
|
|
// new BundleAnalyzerPlugin({ // 插件在这里使用
|
|
@@ -75,8 +75,8 @@ module.exports = {
|
|
|
// openAnalyzer: false
|
|
// openAnalyzer: false
|
|
|
// }),
|
|
// }),
|
|
|
new Webpack.ProvidePlugin({
|
|
new Webpack.ProvidePlugin({
|
|
|
- $: "jquery",
|
|
|
|
|
- jquery: "jquery"
|
|
|
|
|
|
|
+ $: 'jquery',
|
|
|
|
|
+ jquery: 'jquery'
|
|
|
}),
|
|
}),
|
|
|
new CompressionPlugin({
|
|
new CompressionPlugin({
|
|
|
// test: /\.(js|css)?$/i, // 哪些文件要压缩
|
|
// test: /\.(js|css)?$/i, // 哪些文件要压缩
|
|
@@ -84,9 +84,9 @@ module.exports = {
|
|
|
// algorithm: 'gzip', // 使用gzip压缩
|
|
// algorithm: 'gzip', // 使用gzip压缩
|
|
|
// minRatio: 1, // 压缩率小于1才会压缩
|
|
// minRatio: 1, // 压缩率小于1才会压缩
|
|
|
// deleteOriginalAssets: true // 删除未压缩的文件,谨慎设置,如果希望提供非gzip的资源,可不设置或者设置为false
|
|
// deleteOriginalAssets: true // 删除未压缩的文件,谨慎设置,如果希望提供非gzip的资源,可不设置或者设置为false
|
|
|
- filename: "[path].gz[query]", // 压缩后的文件名(保持原文件名,后缀加.gz)
|
|
|
|
|
- algorithm: "gzip", // 使用gzip压缩
|
|
|
|
|
- test: new RegExp("\\.(" + ["js", "css"].join("|") + ")$"), // 匹配文件名
|
|
|
|
|
|
|
+ filename: '[path].gz[query]', // 压缩后的文件名(保持原文件名,后缀加.gz)
|
|
|
|
|
+ algorithm: 'gzip', // 使用gzip压缩
|
|
|
|
|
+ test: new RegExp('\\.(' + ['js', 'css'].join('|') + ')$'), // 匹配文件名
|
|
|
threshold: 10240, // 对超过10k的数据压缩
|
|
threshold: 10240, // 对超过10k的数据压缩
|
|
|
minRatio: 0.8 // 压缩率小于0.8才会压缩
|
|
minRatio: 0.8 // 压缩率小于0.8才会压缩
|
|
|
})
|
|
})
|
|
@@ -101,4 +101,4 @@ module.exports = {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-};
|
|
|
|
|
|
|
+}
|