zoukankan      html  css  js  c++  java
  • webpack配置

    'use strict'
    // Template version: 1.3.1
    // see http://vuejs-templates.github.io/webpack for documentation.
    
    const path = require('path')
    
    module.exports = {
      dev: {
    
        // Paths
        assetsSubDirectory: 'static',//编译暑促的
        assetsPublicPath: '/',//编译发布的根目录
        proxyTable: {
          '*': {//192.168.95.74:9003
            // target:'http://192.168.91.67:9001',
            target: 'http://',// 你请求的第三方接口娄靖龙ip:192.168.91.27 31
            changeOrigin: true,////在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题
            pathRewrite: {
              '/pc': ''// 替换target中的请求地址,也就是说以后你在请求http://api.jisuapi.com/XXXXX这个地址的时候直接写成/api即可。
            }
          },
          '/h5': {//192.168.95.74:9003
            target: 'http://192.168.95.74:9002',// 你请求的第三方接口娄靖龙ip:192.168.91.27 31
            changeOrigin: true,////在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题
            pathRewrite: {
              '/h5': ''// 替换target中的请求地址,也就是说以后你在请求http://api.jisuapi.com/XXXXX这个地址的时候直接写成/api即可。 这里可以做到一个项目如果用到两个ip地址,可以在请求的时候加一个前缀,
    然后代理的时候就可以切换自如。不过一般不建议项目里代理两个地址
    } } }, // Various Dev Server settings host: 'localhost', // can be overwrittengit by process.env.HOST port: 8086, // 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,//是否使用eslint

        /**
         * Source Maps
         */
    
        // https://webpack.js.org/configuration/devtool/#development
        devtool: 'cheap-module-eval-source-map',
    
        // 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,
    
        cssSourceMap: true
      },
      apiUrl: "/api",
      build: {
        // Template for index.html
        index: path.resolve(__dirname, '../dist/index.html'),
    
        // Paths
        assetsRoot: path.resolve(__dirname, '../dist'),
        assetsSubDirectory: 'statics',
        assetsPublicPath: './',
    
    
        /**
         * Source Maps
         */
    
        productionSourceMap: false,
        // https://webpack.js.org/configuration/devtool/#production
        devtool: '#source-map',
    
        // Gzip off by default as many popular static hosts such as
        // Surge or Netlify already gzip all static assets for you.
        // Before setting to `true`, make sure to:
        // npm install --save-dev compression-webpack-plugin
        productionGzip: false,
    // 是否开启生产环境的gzip压缩
    productionGzipExtensions: ['js', 'css'], // Run the build command with an extra argument to // View the bundle analyzer report after build finishes:
    process.env.NODE_ENV != 'production' //如果不是测试环境 本地的一些改动
    
    
  • 相关阅读:
    lincode 题目记录5
    lintcode题目记录4
    lintcode 题目记录3
    lintcode 题目记录2
    剖析ASP.NET Core(Part 2)- AddMvc(译)
    剖析ASP.NET Core MVC(Part 1)- AddMvcCore(译)
    如何 RESTFul 你的服务(译)
    Windows + IIS 环境部署Asp.Net Core App
    Asp.Net Core 缓存的使用(译)
    [转载].NET Core 轻量级模板引擎 Mustachio
  • 原文地址:https://www.cnblogs.com/guidan/p/9234698.html
Copyright © 2011-2022 走看看