const HtmlWebpackPlugin = require('html-webpack-plugin'); const path = require('path') const isProdMode = Object.is(process.env.NODE_ENV, 'production') const baseUrl = process.env.BASE_URL || (isProdMode ? 'https://sso.ubtob.com/' : 'https://test-sso-server.uuzcc.cn/') module.exports = { router: { middleware: 'check-auth' }, transition: { name: 'fade', mode: 'out-in' }, /* ** Headers of the page */ head: { title: '账户中心', meta: [{ charset: 'utf-8' }, { 'http-equiv': 'X-UA-Compatible', content: 'IE=edge,chrome=1' }, { name: 'render', content: 'webkit' }, { name: 'viewport', content: 'width=device-width, initial-scale=1' }, { hid: 'description', name: 'description', content: '账户中心' } ], link: [{ rel: 'icon', type: 'image/x-icon', href: '/U.png' }] }, /* ** Customize the progress-bar color */ loading: '~components/common/nuxt-loading/Loading.vue', /* ** Build configuration */ build: { /* ** Run ESLINT on save */ extractCSS: { allChunks: true }, extend(config, { dev, isClient, isServer }) { Object.assign(config.resolve.alias, { '~utils': path.resolve(__dirname, 'utils'), '~components': path.join(__dirname, 'components'), '~assets': path.join(__dirname, 'assets'), '~plugins': path.join(__dirname, 'plugins'), '~store': path.join(__dirname, 'store') }) // nuxt ^2.00 版本后,webpack HtmlWebpackPlguin插件打包 会存在htlm5不能转换的问题 // 已经命令是将 该插件 压缩部分进行重新处理 for (let i = 0; i < config.plugins.length; i++) { if (config.plugins[i] && config.plugins[i].options && config.plugins[i].options.minify) { config.plugins[i].options.minify = { removeAttributeQuotes: true, collapseWhitespace: true, html5: true, minifyCSS: true, removeComments: true, removeEmptyAttributes: true, } } } // config.resolve.alias['~utils'] = path.join(__dirname, 'utils') // config.resolve.alias['~components'] = path.join(__dirname, 'components') // config.resolve.alias['assets'] = path.join(__dirname, './assets') // config.resolve.alias['~plugins'] = path.join(__dirname, 'plugins') // config.resolve.alias['~store'] = path.join(__dirname, 'store') // config.module.rules.push({ // test: /\.scss$/, // loader: 'vue-style-loader!css-loader!sass-loader' // }) // config.module.rules.push({ // test: /\.js$/, // loader: 'babel-loader' // }) // if (isClient) { // config.module.rules.push({ // enforce: 'pre', // test: /\.(js|vue)$/, // loader: "eslint-loader", // exclude: /node_modules/ // }) // } }, vendor: [ 'axios', 'element-ui', 'mint-ui', 'vuerify', 'vee-validate' ], babel: { presets: ['@nuxt/babel-preset-app'] } // postcss: [ // require('autoprefixer')({ // browsers: ['last 3 versions'] // }) // ] }, css: [{ src: '~assets/scss/mobileCommon.scss', lang: 'scss' }, { src: '~assets/scss/app.scss', lang: 'scss' } ], dev: !isProdMode, env: { baseUrl, }, plugins: [ // { // src: '~plugins/axios-nuxt.js' // }, // { // src: '~plugins/axios.js' // }, { src: '~plugins/element-ui.js' }, { src: '~plugins/mint-ui.js' }, { src: '~plugins/filters.js', ssr: false }, { src: '~plugins/jsonp.js', ssr: false }, { src: '~plugins/vuerify.js', ssr: false }, { src: '~plugins/vee-validate.js', ssr: true } ], /* TODO 代理 */ proxyTable: ['/api/**', '/login/**', '/user**', '/logout**', '/sso/**', '/appeal/**', '/update/user/**', '/valid/**', '/im/**', '/weChat/**', '/bh/**', '/foreign/**'] }