milestone
This commit is contained in:
114
vue.config.js
114
vue.config.js
@@ -1,33 +1,70 @@
|
||||
const { defineConfig } = require("@vue/cli-service");
|
||||
const { defineConfig } = require('@vue/cli-service')
|
||||
const CompressionPlugin = require("compression-webpack-plugin");
|
||||
const WebpackObfuscator = require('webpack-obfuscator');
|
||||
const path = require('path')
|
||||
|
||||
module.exports = defineConfig({
|
||||
const { NODE_ENV, VUE_APP_TITLE = '' } = process.env
|
||||
|
||||
const assetsCDN = {
|
||||
// 忽略打包的第三方库
|
||||
externals: {
|
||||
'vue': 'Vue',
|
||||
'vue-router': 'VueRouter',
|
||||
"crypto-js": "CryptoJS",
|
||||
'pako': 'pako',
|
||||
"html2canvas": "html2canvas",
|
||||
'view-ui-plus':'ViewUIPlus',
|
||||
},
|
||||
|
||||
// 通过cdn方式使用
|
||||
js: [
|
||||
'https://cdn.jsdelivr.net/npm/vue@3.2.47/dist/vue.global.min.js',
|
||||
'https://cdn.jsdelivr.net/npm/vue-router@4.1.6/dist/vue-router.global.min.js',
|
||||
'https://cdn.jsdelivr.net/npm/crypto-js@4.1.1/crypto-js.min.js',
|
||||
'https://cdn.jsdelivr.net/npm/pako@2.1.0/dist/pako.min.js',
|
||||
'https://cdn.jsdelivr.net/npm/view-ui-plus@1.3.10/dist/viewuiplus.min.js',
|
||||
|
||||
'https://cdn.jsdelivr.net/npm/wasm-flate@1.0.2-browser/wasm_flate.min.js',
|
||||
'https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js',
|
||||
],
|
||||
|
||||
css: [
|
||||
'https://cdn.jsdelivr.net/npm/view-ui-plus@1.3.10/dist/styles/viewuiplus.min.css',
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
const config = {
|
||||
|
||||
assetsDir: 'static',
|
||||
productionSourceMap: false,
|
||||
productionSourceMap: NODE_ENV !== 'production',
|
||||
|
||||
configureWebpack: (config) => {
|
||||
config.experiments = { asyncWebAssembly: true, syncWebAssembly: true }
|
||||
|
||||
config.externals = assetsCDN.externals;
|
||||
|
||||
// const assetsCDN = {
|
||||
// // 放置需要使用 cdn 的库
|
||||
// externals: {
|
||||
// 'vue': 'Vue',
|
||||
// 'vue-router': 'VueRouter',
|
||||
// "crypto-js": "CryptoJS",
|
||||
// 'pako': 'pako',
|
||||
// "html2canvas": "html2canvas",
|
||||
// 'view-ui-plus':'ViewUIPlus',
|
||||
// },
|
||||
// css: [
|
||||
// // 存放 引用 css文件的地址
|
||||
// '//unpkg.com/element-plus@1.0.2-beta.48/lib/theme-chalk/index.css',
|
||||
// ],
|
||||
// js: [
|
||||
// // 存放 引用 js 文件的地址
|
||||
// '//unpkg.com/vue@3.1.1/dist/vue.global.js',
|
||||
// '//unpkg.com/element-plus@1.0.2-beta.48/lib/index.full.js'
|
||||
// ]
|
||||
// }
|
||||
|
||||
config.externals = {
|
||||
'vue': 'Vue',
|
||||
'vue-router': 'VueRouter',
|
||||
// 'axios': 'axios',
|
||||
//'vue-axios':'VueAxios',
|
||||
//'buffer': 'Buffer',
|
||||
"crypto-js": "CryptoJS",
|
||||
// 'qrcodejs2': 'QRCode',
|
||||
'pako': 'pako',
|
||||
"view-design": 'iview',
|
||||
"iview": 'ViewUI',
|
||||
//"file-saver": 'saveAs',
|
||||
// "clipboard": "ClipboardJS",
|
||||
// "vue-i18n": "VueI18n",
|
||||
"html2canvas": "html2canvas",
|
||||
"wasm_flate": "wasm_flate"
|
||||
};
|
||||
|
||||
// 为生产环境修改配置
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
@@ -58,26 +95,41 @@ module.exports = defineConfig({
|
||||
)
|
||||
}
|
||||
},
|
||||
transpileDependencies: true,
|
||||
chainWebpack: (config) => {
|
||||
config.plugin("html").tap((args) => {
|
||||
args[0].title = "flagnote.com";
|
||||
|
||||
transpileDependencies: false,
|
||||
|
||||
|
||||
chainWebpack: (setting) => {
|
||||
setting.plugin("html").tap((args) => {
|
||||
args[0].cdn = assetsCDN
|
||||
args[0].title = VUE_APP_TITLE;
|
||||
return args;
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
css: {
|
||||
loaderOptions: {
|
||||
less: {
|
||||
lessOptions: {
|
||||
javascriptEnabled: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
devServer: {
|
||||
proxy: {
|
||||
"/note": {
|
||||
//target: "https://flagnote.com/", // 后台接口域名
|
||||
target: "http://localhost:20000/", // 后台接口域名
|
||||
target: "https://flagnote.com/", // 后台接口域名
|
||||
//target: "http://localhost:20000/", // 后台接口域名
|
||||
secure: false, // 如果是https接口,需要配置这个参数
|
||||
changeOrigin: true, //是否跨域
|
||||
pathRewrite: {
|
||||
// '^/': '/'
|
||||
},
|
||||
}, "^/[abcdefhikmnopqstuvwxyz23456789]{16}\\.txt$": {
|
||||
//target: "https://flagnote.com/", // 后台接口域名
|
||||
target: "http://localhost:20000/", // 后台接口域名
|
||||
target: "https://flagnote.com/", // 后台接口域名
|
||||
//target: "http://localhost:20000/", // 后台接口域名
|
||||
secure: false, // 如果是https接口,需要配置这个参数
|
||||
changeOrigin: true, //是否跨域
|
||||
pathRewrite: {
|
||||
@@ -85,5 +137,7 @@ module.exports = defineConfig({
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = defineConfig(config)
|
||||
Reference in New Issue
Block a user