vue.config.js 配置說明

// vue.config.js 配置說明
// 這里只列一部分,具體配置慘考文檔啊
module.exports = {
    // baseUrl  type:{string} default:'/' 
    // 將部署應(yīng)用程序的基本URL
    // 將部署應(yīng)用程序的基本URL。
    // 默認(rèn)情況下,Vue CLI假設(shè)您的應(yīng)用程序?qū)⒉渴鹪谟虻母夸浵隆?    // https://www.my-app.com/。如果應(yīng)用程序部署在子路徑上,則需要使用此選項指定子路徑。例如,如果您的應(yīng)用程序部署在https://www.foobar.com/my-app/,集baseUrl到'/my-app/'.

    baseUrl: process.env.NODE_ENV === 'production' ? '/online/' : '/',

    // outputDir: 在npm run build時 生成文件的目錄 type:string, default:'dist'

    // outputDir: 'dist',

    // pages:{ type:Object,Default:undfind } 
/*
  構(gòu)建多頁面模式的應(yīng)用程序.每個“頁面”都應(yīng)該有一個相應(yīng)的JavaScript條目文件。該值應(yīng)該是一
  個對象,其中鍵是條目的名稱,而該值要么是指定其條目、模板和文件名的對象,要么是指定其條目
  的字符串,
  注意:請保證pages里配置的路徑和文件名 在你的文檔目錄都存在 否則啟動服務(wù)會報錯的
*/
    // pages: {
        // index: {
            // entry for the page
            // entry: 'src/index/main.js',
            // the source template
            // template: 'public/index.html',
            // output as dist/index.html
            // filename: 'index.html'
        // },
        // when using the entry-only string format,
        // template is inferred to be `public/subpage.html`
        // and falls back to `public/index.html` if not found.
        // Output filename is inferred to be `subpage.html`.
        // subpage: 'src/subpage/main.js'
    // },

    //   lintOnSave:{ type:Boolean default:true } 問你是否使用eslint
    lintOnSave: true,
    // productionSourceMap:{ type:Bollean,default:true } 生產(chǎn)源映射
    // 如果您不需要生產(chǎn)時的源映射,那么將此設(shè)置為false可以加速生產(chǎn)構(gòu)建
    productionSourceMap: false,
    // devServer:{type:Object} 3個屬性host,port,https
    // 它支持webPack-dev-server的所有選項

    devServer: {
        port: 8085, // 端口號
        host: 'localhost',
        https: false, // https:{type:Boolean}
        open: true, //配置自動啟動瀏覽器
        // proxy: 'http://localhost:4000' // 配置跨域處理,只有一個代理
        proxy: {
            '/api': {
                target: '<url>',
                ws: true,
                changeOrigin: true
            },
            '/foo': {
                target: '<other_url>'
            }
        },  // 配置多個代理
    }
}
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容