index.js 2.8 KB
Newer Older
Y
yma16 已提交
1
"use strict";
yma16's avatar
yma16 已提交
2 3 4
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.

Y
yma16 已提交
5
const path = require("path");
yma16's avatar
yma16 已提交
6 7

module.exports = {
Y
yma16 已提交
8 9
  dev: {
    // Paths
yma16's avatar
yma16 已提交
10
    assetsSubDirectory: "myblog_static",
Y
yma16 已提交
11 12 13
    assetsPublicPath: "/",
    proxyTable: {
      "/api/": {
yma16's avatar
yma16 已提交
14
        target: "https://yongma16.xyz/", //后端接口地址
Y
yma16 已提交
15 16 17 18
        ws: true, //接受websocket请求
        changeOrigin: true, //是否允许跨越
        chunkOrigins: true,
        pathRewrite: {
yma16's avatar
yma16 已提交
19
          "^/api": "api", //重写,
yma16's avatar
yma16 已提交
20
        },
Y
yma16 已提交
21 22
      },
      "/ws_api/": {
yma16's avatar
yma16 已提交
23
        target: "wss://yongma16.xyz/ws/webchat/",
Y
yma16 已提交
24 25 26 27 28 29 30 31
        ws: true, //接受websocket请求
        changeOrigin: true, //是否允许跨越
        chunkOrigins: true,
        pathRewrite: {
          "^/ws_api": "", //重写,
        },
      },
    },
yma16's avatar
yma16 已提交
32

Y
yma16 已提交
33 34 35 36 37 38 39
    // Various Dev Server settings
    host: "localhost", // can be overwritten by process.env.HOST
    port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
    autoOpenBrowser: false,
    errorOverlay: true,
    notifyOnErrors: true,
    poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
yma16's avatar
yma16 已提交
40

Y
yma16 已提交
41 42 43 44 45 46 47
    // Use Eslint Loader?
    // If true, your code will be linted during bundling and
    // linting errors and warnings will be shown in the console.
    useEslint: false,
    // If true, eslint errors and warnings will also be shown in the error overlay
    // in the browser.
    showEslintErrorsInOverlay: false,
yma16's avatar
yma16 已提交
48

Y
yma16 已提交
49 50 51
    /**
     * Source Maps
     */
yma16's avatar
yma16 已提交
52

Y
yma16 已提交
53 54
    // https://webpack.js.org/configuration/devtool/#development
    devtool: "cheap-module-eval-source-map",
yma16's avatar
yma16 已提交
55

Y
yma16 已提交
56 57 58 59
    // If you have problems debugging vue-files in devtools,
    // set this to false - it *may* help
    // https://vue-loader.vuejs.org/en/options.html#cachebusting
    cacheBusting: true,
yma16's avatar
yma16 已提交
60

61
    cssSourceMap: true,
Y
yma16 已提交
62
  },
yma16's avatar
yma16 已提交
63

Y
yma16 已提交
64 65 66 67 68
  build: {
    // Template for index.html
    index: path.resolve(__dirname, "../dist/index.html"),
    // Paths
    assetsRoot: path.resolve(__dirname, "../dist"),
yma16's avatar
yma16 已提交
69
    assetsSubDirectory: "myblog_static",
Y
yma16 已提交
70 71 72 73
    assetsPublicPath: "./",
    /**
     * Source Maps
     */
yma16's avatar
yma16 已提交
74
    productionSourceMap: false,
Y
yma16 已提交
75 76
    // https://webpack.js.org/configuration/devtool/#production
    devtool: "#source-map",
yma16's avatar
yma16 已提交
77 78
    // Gzip off by default as many popular myblog_static hosts such as
    // Surge or Netlify already gzip all myblog_static assets for you.
Y
yma16 已提交
79 80
    // Before setting to `true`, make sure to:
    // npm install --save-dev compression-webpack-plugin
yma16's avatar
yma16 已提交
81
    productionGzip: true,
Y
yma16 已提交
82
    productionGzipExtensions: ["js", "css"],
yma16's avatar
yma16 已提交
83

Y
yma16 已提交
84 85 86 87 88 89 90
    // Run the build command with an extra argument to
    // View the bundle analyzer report after build finishes:
    // `npm run build --report`
    // Set to `true` or `false` to always turn it on or off
    bundleAnalyzerReport: process.env.npm_config_report,
  },
};