代码拉取完成,页面将自动刷新
// eslint-disable-next-line nuxt/no-cjs-in-config
const path = require('path')
// eslint-disable-next-line nuxt/no-cjs-in-config
const fg = require('fast-glob')
const filePath = fg.sync('./modules/**/route.js', {
deep: 2,
onlyFiles: true,
})
const routes = filePath.reduce((allRoutes, cur) => {
const file = require(cur).default
console.log('cur:',cur)
return allRoutes.concat(file)
}, [])
// 不能以斜杠结尾
const apiServer = (process.env.API_SERVER || '').trim()
const isProd = process.env.MODE === 'prod' || process.env.MODE === 'uat' || process.env.MODE === 'test'
const publicPath = process.env.PUBLIC_PATH || './'
console.log(isProd, publicPath)
let axios = {
proxy: true,
}
// 如果生产指定apiServer, 则使用绝对路径请求api
if (isProd && apiServer) {
axios = {
proxy: false,
baseURL: apiServer
}
}
export default {
mode: 'spa',
ssr: false,
server: {
host: '0.0.0.0',
port: 3600,
},
// env: {
// Mode: process.env.MODE,
// Company_Id: process.env.COMPANY_ID,
// },
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: 'h5-front-code',
htmlAttrs: {
lang: 'en'
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1, user-scalable=no, viewport-fit=cover' },
{ hid: 'description', name: 'description', content: process.env.npm_package_description || '' },
{ name: 'format-detection', content: 'telephone=no' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
],
script: [
// {
// type: 'text/javascript',
// src: 'https://g.alicdn.com/dingding/dingtalk-jsapi/2.10.3/dingtalk.open.js'
// },
],
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
{
src: '~assets/normalize.less',
lang: 'less',
},
{
src: '~/assets/global.less',
lang: 'less',
},
'vant/lib/index.less'
],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
'@/plugins/vant'
],
router: {
// base: '/market-web-h5/',
mode: 'hash',
extendRoutes(r, resolve) {
r.unshift({
path: '/',
redirect: '/home'
})
r.unshift(...routes)
},
},
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
],
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
[isProd ? 'publicPath' : '']: publicPath,
// 提取css到单独link文件
extractCSS: true,
loaders: {
less: {
modifyVars: {
hack: `true; @import "~assets/element-variable.less";`
}
}
},
babel: {
plugins: [
// [
// 'import',
// {
// libraryName: 'vant',
// libraryDirectory: 'es',
// style: true,
// },
// 'vant',
// ],
],
},
},
proxy: {
// 内容中心
"/dxp-domain-cms": {
changeOrigin: true,
target: 'http://127.0.0.1:36001'
},
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。