12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- const ENV = process.env.NODE_ENV
- const useCDN = process.env.URL === 'cdn'
- const path = require('path')
- function resolve (dir) {
- return path.join(__dirname, dir)
- }
- let baseUrl = getBaseUrl()
- let trimUrl = baseUrl
- if (trimUrl.indexOf('//') === -1) {
- trimUrl = trimUrl.substr(1)
- }
- module.exports = {
- // indexPath: ENV === 'production' ? '../protected/views/index.html' : 'index.html',
- outputDir: './dist', // build 时生成的生产环境构建文件的目录
- baseUrl: baseUrl,
- 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'
- },
- h5: {
- entry: '_src/pages/h5/main.js',
- template: 'public/h5.html',
- title: 'MeeChat',
- filename: ENV === 'production' ? '../protected/views/h5.html' : 'h5.html'
- }
- },
- chainWebpack: (config) => {
- config.resolve.alias
- .set('@', resolve('_src'))
- },
- css: {
- loaderOptions: {
- sass: {
- data: `@import "@/style/mixins.scss";`
- }
- }
- },
- pwa: {
- name: 'MeeChat',
- assetsVersion: '1.0',
- workboxPluginMode: 'InjectManifest',
- workboxOptions: {
- // directoryIndex: null,
- importWorkboxFrom: 'disabled',
- swSrc: 'public/sw.js'
- },
- iconPaths: {
- favicon32: trimUrl + 'img/icons/meechat.png?imageview/0/w/64',
- favicon16: trimUrl + 'img/icons/meechat.png?imageview/0/w/32',
- appleTouchIcon: trimUrl + 'img/icons/meechat.png?imageview/0/w/152',
- maskIcon: 'img/icons/safari-pinned-tab.svg',
- msTileImage: trimUrl + 'img/icons/meechat.png?imageview/0/w/144'
- }
- }
- }
- function getBaseUrl () {
- if (ENV === 'production') {
- return useCDN ? '//static.meechat.me/cdn/mee.chat/dist/' : '/dist/'
- } else {
- return '/'
- }
- }
|