Commit 1d18e478 by 展昭

add config

parent f2379c20
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
'@vue/app'
],
plugins: [
['import', {
......
......@@ -4834,7 +4834,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
......@@ -4855,12 +4856,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
......@@ -4875,17 +4878,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
......@@ -5002,7 +5008,8 @@
"inherits": {
"version": "2.0.4",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
......@@ -5014,6 +5021,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
......@@ -5028,6 +5036,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
......@@ -5035,12 +5044,14 @@
"minimist": {
"version": "1.2.5",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.9.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
......@@ -5059,6 +5070,7 @@
"version": "0.5.3",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "^1.2.5"
}
......@@ -5120,7 +5132,8 @@
"npm-normalize-package-bin": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"npm-packlist": {
"version": "1.4.8",
......@@ -5148,7 +5161,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
......@@ -5160,6 +5174,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
......@@ -5237,7 +5252,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
......@@ -5273,6 +5289,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
......@@ -5292,6 +5309,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
......@@ -5335,12 +5353,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},
......
import api from "../index";
import urls from "./urls";
import Mgr from "@js/SecurityService";
import { GetCommonPms } from "@js/CommonPms.js";
import qs from "qs";
const oidc_config = JSON.parse(process.env.VUE_APP_OIDC_CONFIG)
let mgr = new Mgr();
let token;
mgr.getAcessToken().then(res => {
token = res;
});
let header = {
"Content-type": "application/x-www-form-urlencoded"
}
export default {
GetToken(id) {
let pms = {
client_id: oidc_config.client_id,
client_secret: oidc_config.client_secret,
grant_type: "company",
scope: "api.workapps.user api.workapps.org",
comid: id,
token: token
};
var commonPms = GetCommonPms();
return api.post(`${urls.token}?${commonPms}`, qs.stringify(pms), header);
},
getHtml(url){
let param = {
accept: 'text/html, text/plain'
}
return api.get(url,param);
}
};
\ No newline at end of file
const path = require("path");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
// gzip --start
const CompressionWebpackPlugin = require("compression-webpack-plugin")
const productionGzipExtensions = ["js", "css"]; // 需要gzip压缩的文件后缀
module.exports = {
// 部署应用时的基本 URL
// baseUrl: process.env.NODE_ENV === "production" ? "192.168.60.110:8080" : "192.168.60.110:8080",
publicPath: process.env.VUE_APP_PUBLIC_DIR,
// publicPath: IS_PROD ? "/mobile" : "/",
// build时构建文件的目录 构建时传入 --no-clean 可关闭该行为
outputDir: "dist",
// build时放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录
assetsDir: "",
// 指定生成的 index.html 的输出路径 (相对于 outputDir)。也可以是一个绝对路径。
//indexPath: "index.html",
pages: {
app: {
entry: "src/main.js",
template: "public/index.html",
filename: "index.html",
excludeChunks: ["silent-renew-oidc"]
},
silentrenewoidc: {
entry: "src/assets/js/SilentRenew.js",
template: "public/silentrenew.html",
filename: "silentrenew.html",
excludeChunks: ["app"]
},
callback: {
entry: "src/assets/js/CallBack.js",
template: "public/callback.html",
filename: "callback.html",
excludeChunks: ["app"]
}
},
// 默认在生成的静态资源文件名中包含hash以控制缓存
filenameHashing: true,
// 是否在开发环境下通过 eslint-loader 在每次保存时 lint 代码 (在生产构建时禁用 eslint-loader)
// lintOnSave: process.env.NODE_ENV !== "production",
lintOnSave: false,
// 是否使用包含运行时编译器的 Vue 构建版本
runtimeCompiler: false,
// Babel 显式转译列表
transpileDependencies: [],
// 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建
productionSourceMap: false,
// 设置生成的 HTML 中 <link rel="stylesheet"> 和 <script> 标签的 crossorigin 属性(注:仅影响构建时注入的标签)
crossorigin: "",
// 在生成的 HTML 中的 <link rel="stylesheet"> 和 <script> 标签上启用 Subresource Integrity (SRI)
integrity: false,
// 如果这个值是一个对象,则会通过 webpack-merge 合并到最终的配置中
// 如果你需要基于环境有条件地配置行为,或者想要直接修改配置,那就换成一个函数 (该函数会在环境变量被设置之后懒执行)。该方法的第一个参数会收到已经解析好的配置。在函数内,你可以直接修改配置,或者返回一个将会被合并的对象
configureWebpack: config => {
if (process.env.NODE_ENV === "production") {
config.plugins = config.plugins.concat([
new UglifyJsPlugin({
uglifyOptions: {
warnings: false,
compress: {
drop_debugger: true,
drop_console: false
}
}
})
]);
// gzip
// 2. 构建时开启gzip,降低服务器压缩对CPU资源的占用,服务器也要相应开启gzip
config.plugins.push(
new CompressionWebpackPlugin({
algorithm: "gzip",
test: new RegExp(
"\\.(" + productionGzipExtensions.join("|") + ")$"
),
threshold: 10240,
minRatio: 0.8
})
);
}
Object.assign(config, {
// 开发生产共同配置
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
"@img": path.resolve(__dirname, "./src/assets/images"),
"@js": path.resolve(__dirname, "./src/assets/js"),
"@components": path.resolve(__dirname, "./src/components/"),
"vue$": 'vue/dist/vue.common.js'
},
modules: [path.resolve(__dirname,'node_modules')]
}
});
},
// 对内部的 webpack 配置(比如修改、增加Loader选项)(链式操作)
chainWebpack: () => { },
// css的处理
css: {
// 当为true时,css文件名可省略 module 默认为 false
modules: false,
// 是否将组件中的 CSS 提取至一个独立的 CSS 文件中,当作为一个库构建时,你也可以将其设置为 false 免得用户自己导入 CSS
// 默认生产环境下是 true,开发环境下是 false
extract: false,
// 是否为 CSS 开启 source map。设置为 true 之后可能会影响构建的性能
sourceMap: false,
//向 CSS 相关的 loader 传递选项(支持 css-loader postcss-loader sass-loader less-loader stylus-loader)
loaderOptions: {
// postcss: {
// plugins: [require("postcss-px2rem")({ remUnit: 75 })]
// },
css: {},
less: {}
}
},
// 是否为 Babel 或 TypeScript 使用 thread-loader
parallel: require("os").cpus().length > 1,
// 向 PWA 插件传递选项
pwa: {},
// eslint-disable-next-line no-dupe-keys
devServer: {
host: "0.0.0.0",
port: 8080,
https: false,
hotOnly: false, // 热更新
proxy: null // 设置代理
},
// 可以用来传递任何第三方插件选项
pluginOptions: {}
};
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment