const ENV = process.env.NODE_ENV // const useCDN = process.env.URL === 'cdn' const path = require('path') global.URL_API = '//test.mee.chat/' global.URL_CDN = '/' if (process.env.URL === 'new') { global.URL_CDN = '//static.meechat.me/cdn/new.mee.chat/' global.URL_API = '//new.mee.chat/' } else if (process.env.URL === 'form') { global.URL_CDN = '//static.meechat.me/cdn/mee.chat/' global.URL_API = '//mee.chat/' } console.log(`URL_API: ${global.URL_API}`) console.log(`URL_CDN: ${global.URL_CDN}`) let baseUrl = getBaseUrl() let config = { // indexPath: ENV === 'production' ? '../protected/views/index.html' : 'index.html', outputDir: './dist', // build 时生成的生产环境构建文件的目录 publicPath: baseUrl, lintOnSave: true, // 关闭eslint productionSourceMap: false, // 生产环境取消source map pages: { mini: { entry: '_src/pages/mini/main.js', template: 'public/mini.html', title: 'MeeChat', filename: ENV === 'production' ? '../mini.html' : 'mini.html' }, h5: { entry: '_src/pages/h5/main.js', template: 'public/h5.html', title: 'MeeChat', filename: ENV === 'production' ? '../protected/views/h5.html' : 'h5.html' }, pc: { entry: '_src/pages/index/main.js', title: 'MeeChat', filename: ENV === 'production' ? '../protected/views/index.html' : 'index.html' } }, chainWebpack: (config) => { config.resolve.alias .set('@', resolve('_src')) }, css: { loaderOptions: { sass: { data: `@import "@/style/mixins.scss";` } } } // pwa: { // name: 'MeeChat', // assetsVersion: '1.1.2', // workboxPluginMode: 'InjectManifest', // workboxOptions: { // importWorkboxFrom: 'disabled', // swSrc: 'public/sw.js' // }, // iconPaths: { // favicon32: 'img/icons/meechat.png?imageview/0/w/64', // favicon16: 'img/icons/meechat.png?imageview/0/w/32', // appleTouchIcon: 'img/icons/meechat.png?imageview/0/w/152', // maskIcon: 'img/icons/safari-pinned-tab.svg', // msTileImage: 'img/icons/meechat.png?imageview/0/w/144' // } // } } function resolve (dir) { return path.join(__dirname, dir) } function getBaseUrl () { if (ENV === 'production') { return global.URL_CDN + 'dist/' } else { return global.URL_CDN } } module.exports = config