153 lines
5.0 KiB
TypeScript
153 lines
5.0 KiB
TypeScript
// import { base_api } from '~/constants/index'
|
||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||
import postcsspxtoviewport from 'postcss-px-to-viewport'
|
||
export default defineNuxtConfig({
|
||
// devServer: {
|
||
// port: 6188,
|
||
// },
|
||
|
||
devtools: {
|
||
enabled: process.env.NODE_ENV === 'development',
|
||
},
|
||
debug: process.env.NODE_ENV === 'development', // 开启详细调试日志
|
||
|
||
ssr: true,
|
||
modules: ['@unocss/nuxt', '@pinia/nuxt', '@element-plus/nuxt', 'pinia-plugin-persistedstate/nuxt'],
|
||
unocss: {
|
||
nuxtLayers: true,
|
||
},
|
||
elementPlus: {
|
||
importStyle: 'scss', // 或 'css',确保样式被全局导入
|
||
themes: ['dark'], // 按需配置主题
|
||
},
|
||
css: ['element-plus/dist/index.css', '~/assets/scss/app.scss'],
|
||
vite: {
|
||
css: {
|
||
preprocessorOptions: {
|
||
scss: {
|
||
additionalData: `@use "~/assets/scss/variables.scss" as *; @use "~/assets/scss/mixins.scss" as *;`,
|
||
},
|
||
},
|
||
postcss: {
|
||
plugins: [
|
||
postcsspxtoviewport({
|
||
unitToConvert: 'px', // 要转化的单位
|
||
viewportWidth: 750, // UI设计稿的宽度
|
||
unitPrecision: 6, // 转换后的精度,即小数点位数
|
||
propList: ['*'], // 指定转换的css属性的单位,*代表全部css属性的单位都进行转换
|
||
viewportUnit: 'vw', // 指定需要转换成的视窗单位,默认vw
|
||
fontViewportUnit: 'vw', // 指定字体需要转换成的视窗单位,默认vw
|
||
selectorBlackList: ['el-'], // 指定不转换为视窗单位的类名,例如van-(vantUI组件),
|
||
minPixelValue: 1, // 默认值1,小于或等于1px则不进行转换
|
||
mediaQuery: true, // 是否在媒体查询的css代码中也进行转换,默认false
|
||
replace: true, // 是否转换后直接更换属性值
|
||
exclude: [/node_modules/, /^(?!.*\/pages\/m\/).*$/], // 排除node_modules和非pages/m目录下的文件
|
||
landscape: false, // 是否处理横屏情况
|
||
// 只转换pages下的m文件
|
||
include: [/pages\/m/],
|
||
}),
|
||
],
|
||
},
|
||
},
|
||
optimizeDeps: {
|
||
include: ['naive-ui'],
|
||
},
|
||
// 生产环境构建优化
|
||
build: {
|
||
// 生产环境移除 console 和 debugger
|
||
minify: 'esbuild',
|
||
target: 'es2020',
|
||
},
|
||
esbuild: {
|
||
// 生产环境下移除所有 console 语句和 debugger
|
||
drop: process.env.NODE_ENV === 'production' ? ['console', 'debugger'] : [],
|
||
},
|
||
},
|
||
|
||
// 页面过渡配置
|
||
app: {
|
||
// pageTransition: {
|
||
// name: "page",
|
||
// mode: "out-in",
|
||
// duration: 400,
|
||
// },
|
||
// layoutTransition: {
|
||
// name: "default",
|
||
// mode: "out-in",
|
||
// duration: 400,
|
||
// },
|
||
head: {
|
||
title: '图夕夕-世界图纸 夕夕共享',
|
||
htmlAttrs: {
|
||
lang: 'en',
|
||
},
|
||
meta: [
|
||
{ charset: 'utf-8' },
|
||
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
||
{
|
||
name: 'description',
|
||
content: '图夕夕是一家图纸素材分享交易平台,提供AutoCAD/ProE/Creo/CATIA/UG/inventor/CAXA/等建筑图纸的素材下载及免费教程。',
|
||
},
|
||
{ name: 'keywords', content: '图纸,图纸下载,设计素材,图纸大全,设计图纸,,工程图纸,cad图纸' },
|
||
{ name: 'author', content: '图夕夕' },
|
||
// SEO meta tags
|
||
// {
|
||
// property: 'og:title',
|
||
// content: '图纸,图纸下载,设计素材,图纸大全,设计图纸,,工程图纸,cad图纸',
|
||
// },
|
||
// {
|
||
// property: 'og:description',
|
||
// content: '图夕夕是一家图纸素材分享交易平台,提供AutoCAD/ProE/Creo/CATIA/UG/inventor/CAXA/等建筑图纸的素材下载及免费教程。',
|
||
// },
|
||
// { property: 'og:type', content: 'website' },
|
||
// { property: 'og:url', content: 'https://www.xlcig.cn' },
|
||
// { property: 'og:site_name', content: 'xlCig' },
|
||
// { name: 'theme-color', content: '#00f5ff' },
|
||
// // robots meta
|
||
// { name: 'robots', content: 'index, follow' },
|
||
],
|
||
link: [
|
||
{ rel: 'icon', type: 'image/x-icon', href: '/favicon2.ico' },
|
||
{ rel: 'stylesheet', type: 'text/css', href: 'https://unpkg.com/swiper@8/swiper-bundle.css' },
|
||
],
|
||
script: [
|
||
{
|
||
type: 'text/javascript',
|
||
src: 'https://unpkg.com/swiper@8/swiper-bundle.js',
|
||
},
|
||
],
|
||
},
|
||
},
|
||
|
||
runtimeConfig: {
|
||
public: {
|
||
// API 基础地址
|
||
apiBase: 'https://tuxixi.net',
|
||
|
||
// 应用信息
|
||
appName: 'xlCig',
|
||
appVersion: '1.0.0',
|
||
|
||
// 调试模式
|
||
debug: process.env.NODE_ENV === 'development',
|
||
|
||
// 环境标识
|
||
environment: process.env.NODE_ENV || 'development',
|
||
},
|
||
},
|
||
|
||
build: {
|
||
transpile: ['vueuc', '@css-render/vue3-ssr', '@tinymce/tinymce-vue', 'tinymce'],
|
||
},
|
||
plugins: [
|
||
// 在这里引入插件
|
||
{
|
||
src: '~/plugins/wang-editor',
|
||
mode: 'client',
|
||
},
|
||
],
|
||
piniaPluginPersistedstate: {
|
||
storage: 'localStorage',
|
||
},
|
||
})
|