lightlimx-website/nuxt.config.js

131 lines
3.8 KiB
JavaScript
Raw Normal View History

2024-07-10 14:57:22 +08:00
import redirectSSL from 'redirect-ssl'
import serveStatic from 'serve-static'
import {resolve} from "path";
const baseUrl = process.env.BASE_URL || 'https://api.lightlimx.live/api'
export default {
loading: '~/components/Loading/index.vue',
serverMiddleware: [
// redirectSSL.create({
// enabled: process.env.NODE_ENV === 'production'
// }),
{ path: '/static', handler: serveStatic(__dirname + '/static') }
],
telemetry:false,
publicRuntimeConfig: {
baseURL: baseUrl,
axios: {
baseURL: baseUrl
}
},
env: {
baseUrl: process.env.BASE_URL || 'http://localhost:3000',
apiUrl: '/api'
},
alias: {
'@': resolve(__dirname),
'~': resolve(__dirname),
style: resolve(__dirname, './assets/style'),
images: resolve(__dirname, './assets/images'),
data: resolve(__dirname, './assets/data')
},
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: 'LightLimX',
htmlAttrs: {
lang: 'en',
},
bodyAttrs: {
class: 'h5-scroll-bar'
},
meta: [
{ charset: 'utf-8' },
//width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no
{ name: 'viewport', content: 'width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui,viewport-fit=cover' },
{ hid: 'description', name: 'description', content: '' },
{ name: 'format-detection', content: 'telephone=no' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.png' }
]
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
'~/assets/style/reset.less',
'~/assets/style/animate.css',
'vant/lib/index.css'
],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
{ src: '~/plugins/remJs.js', mode: 'client' },
'@/plugins/vant',
'~/plugins/axios.js',
'~/plugins/vueTooltip.js',
// { src: '~/plugins/vueAnimate.js', mode: 'client' },
{ src: '~/plugins/vueClipboard.js', mode: 'client' },
{ src: '~/plugins/lottieWeb.js', mode: 'client' },
{ src: '~/plugins/svgIcon.js', mode: 'client' },
{ src: '~/plugins/wow.js', mode: 'client' },
{ src: '~/plugins/element.js', mode: 'client' },
],
router: {
// base: '/assets/',
middleware: ['authenticated']
},
// 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: [
['nuxt-svg-sprite-loader', {
symbolId: 'icon-[name]'
}],
'@nuxtjs/axios'
],
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
transpile: ['vue-tooltip'],
extractCSS: {
// allChunks: true,
filename: '[name].css',
chunkFilename: '[id].css',
ignoreOrder: true
},
babel: {
plugins: [
[
'component',
{
'libraryName': 'element-ui',
// 'style': false // 不引入对应的css文件
'styleLibraryName': 'theme-chalk'
}
]
]
},
extend (config, { isDev, isClient }) {
if (isClient) {
// 排除 nuxt 原配置的影响,Nuxt 默认有vue-loader,会处理svg,img等
// 找到匹配.svg的规则,然后将存放svg文件的目录排除
const svgRule = config.module.rules.find(rule => rule.test.test('.svg'))
svgRule.exclude = [resolve('assets/svg')]
// 添加loader规则
}
config.module.rules.push({
test: /\.(mpg|ts|pm4)$/i,
loader: 'url-loader',
options: {
outputPath: '/static/video/',
publicPath: '/static/video/'
}
})
}
}
}