// 这里只列一部分,具体配置惨考文档啊
module.exports = {
// baseUrl type:{string} default:'/'
// 将部署应用程序的基本URL
// 将部署应用程序的基本URL。
// 默认状况下,Vue CLI假设您的应用程序将部署在域的根目录下。
// https://www.my-app.com/。若是应用程序部署在子路径上,则须要使用此选项指定子路径。例如,若是您的应用程序部署在https://www.foobar.com/my-app/,集baseUrl到'/my-app/'.
baseUrl: process.env.NODE_ENV === 'production' ? '/' : '/',
// outputDir: 在npm run build时 生成文件的目录 type:string, default:'dist'
// outputDir: 'dist',
// pages:{ type:Object,Default:undfind }
/* 构建多页面模式的应用程序.每一个“页面”都应该有一个相应的JavaScript条目文件。该值应该是一 个对象,其中键是条目的名称,而该值要么是指定其条目、模板和文件名的对象,要么是指定其条目 的字符串, 注意:请保证pages里配置的路径和文件名 在你的文档目录都存在 不然启动服务会报错的 */
// 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'
// },
// webpack配置
// see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
// chainWebpack: () => {},
// configureWebpack: () => {},
// vue-loader 配置项
// https://vue-loader.vuejs.org/en/options.html
// 生产环境是否生成 sourceMap 文件
// lintOnSave:{ type:Boolean default:true } 问你是否使用eslint
lintOnSave: true,
// productionSourceMap:{ type:Bollean,default:true } 生产源映射
// 若是您不须要生产时的源映射,那么将此设置为false能够加速生产构建
productionSourceMap: true,
// devServer:{type:Object} 3个属性host,port,https
// 它支持webPack-dev-server的全部选项
devServer: {
port: 8081, // 端口号
host: 'localhost', // 'localhost'
https: false, // https:{type:Boolean}
open: true, //配置自动启动浏览器
// proxy: 'http://localhost:4000' // 配置跨域处理,只有一个代理
proxy: {
'/api': {
target: '<url>',
ws: true,
changeOrigin: true
},
'/foo': {
target: '<other_url>'
}
}, // 配置多个代理
}, // css相关配置
css: {
extract: true, // 是否使用css分离插件 ExtractTextPlugin
sourceMap: false, // 开启 CSS source maps?
loaderOptions: {
less: {
javascriptEnabled: true //less 配置
}
}, // css预设器配置项
modules: false // 启用 CSS modules for all css / pre-processor files.
},
configureWebpack: config => {
require('vux-loader').merge(config, {
options: {},
plugins: ['vux-ui'] // 添加vux
})
}
}
复制代码