vue.config.js配置

vue-cli3 脚手架搭建完成后,项目目录中没有 vue.config.js 文件,需要手动创建

module.exports = {
    //  基本路径
    publicPath: "./",

    //  构建时的输出目录
    outputDir: "dist",

    //  放置静态资源的目录
    assetsDir: "static",

    //  html 的输出路径
    indexPath: "index.html",

    //文件名哈希
    filenameHashing: true,

    //用于多页配置,默认是 undefined
    pages: {
        index: {
            // page 的入口文件
            entry: 'src/index/main.js',

            // 模板文件
            template: 'public/index.html',

            // 在 dist/index.html 的输出文件
            filename: 'index.html',

            // 当使用页面 title 选项时,
            // template 中的 title 标签需要是 <%= htmlWebpackPlugin.options.title %>
            title: 'Index Page',

            // 在这个页面中包含的块,默认情况下会包含
            // 提取出来的通用 chunk 和 vendor chunk。
            chunks: ['chunk-vendors', 'chunk-common', 'index']

        },

        // 当使用只有入口的字符串格式时,
        // 模板文件默认是 `public/subpage.html`
        // 如果不存在,就回退到 `public/index.html`。
        // 输出文件默认是 `subpage.html`。
        subpage: 'src/subpage/main.js'

    },

    //  是否在保存的时候使用 `eslint-loader` 进行检查。
    lintOnSave: true,

    //  是否使用带有浏览器内编译器的完整构建版本
    runtimeCompiler: false,

    //  babel-loader 默认会跳过 node_modules 依赖。
    transpileDependencies: [ /* string or regex */ ],

    //  是否为生产环境构建生成 source map?
    productionSourceMap: true,

    //  设置生成的 HTML 中 
                    
                    

你可能感兴趣的:(vue.config.js配置)