const ENV = process.env.NODE_ENV const path = require('path') function resolve (dir) { return path.join(__dirname, dir) } module.exports = { // indexPath: ENV === 'production' ? '../protected/views/index.html' : 'index.html', outputDir: './dist', // build 时生成的生产环境构建文件的目录 baseUrl: ENV === 'production' ? '/dist/' : '/', lintOnSave: true, // 关闭eslint productionSourceMap: false, // 生产环境取消source map pages: { index: { entry: '_src/pages/index/main.js', title: 'MeeChat', filename: ENV === 'production' ? '../protected/views/index.html' : 'index.html' }, mini: { entry: '_src/pages/mini/main.js', template: 'public/mini.html', title: 'MeeChat', filename: ENV === 'production' ? '../protected/views/mini.html' : 'mini.html' } }, chainWebpack: (config) => { config.resolve.alias .set('@', resolve('_src')) }, css: { loaderOptions: { sass: { data: `@import "@/style/mixins.scss";` } } } }