12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- /*
- * @Author: your name
- * @Date: 2021-11-28 01:41:11
- * @LastEditTime: 2022-05-08 20:02:12
- * @LastEditors: 张祥 17839092765@163.com
- * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
- * @FilePath: \vue3ts\vue3\vue.config.js
- */
- const title = "鹤山工业城可视化平台";
- module.exports = {
- publicPath: "/",
- devServer: {
- // 配置服务器
- open: true,
- // 项目运行时候的端口号
- port: 8080,
- // https: false,
- disableHostCheck: true,
- overlay: {
- warnings: true,
- errors: true,
- },
- proxy: {
- "/api": {
- target: "http://127.0.0.1:8084/",
- changeOrigin: true,
- pathRewrite: {
- "^/api": "",
- },
- },
- "/restapi": {
- target: "https://restapi.amap.com/",
- changeOrigin: true,
- pathRewrite: {
- "^/restapi": "",
- },
- },
- },
- },
- css: {
- sourceMap: true, // 开启 CSS source maps
- loaderOptions: {
- sass: {
- prependData: "@import '@/styles/common.scss';",
- },
- },
- },
- chainWebpack: (config) => {
- config.plugin("html").tap((args) => {
- args[0].title = title;
- return args;
- });
- if (process.env.NODE_ENV === "production") {
- //生产包取消console debugger打印
- config.optimization.minimizer("terser").tap((args) => {
- args[0].terserOptions.compress.drop_console = true;
- args[0].terserOptions.compress.drop_debugger = true;
- args[0].terserOptions.compress.pure_funcs = ["console.log"];
- args[0].terserOptions.output = {
- comments: false,
- };
- return args;
- });
- }
- // 分析打包大小
- if (process.env.npm_config_report) {
- config
- .plugin("webpack-bundle-analyzer")
- .use(require("webpack-bundle-analyzer").BundleAnalyzerPlugin)
- .end();
- }
- },
- configureWebpack: {
- resolve: {
- extensions: [".js", ".vue", ".json", ".ts", ".tsx"], // 加入ts 和 tsx
- },
- },
- };
|