This repository has been archived by the owner on Dec 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
nuxt.config.ts
100 lines (96 loc) · 2.35 KB
/
nuxt.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import Components from "unplugin-vue-components/vite";
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
import IconsResolver from "unplugin-icons/resolver";
import { antdTheme } from "./tools/antdTheme";
// https://v3.nuxtjs.org/api/configuration/nuxt.config
const isDev = process.env.NODE_ENV === "development";
export default defineNuxtConfig({
ssr: true,
typescript: {
tsConfig: {
compilerOptions: {
types: ["unplugin-icons/types/vue"],
},
},
},
modules: ["@vueuse/nuxt", "nuxt-lodash"],
lodash: {
prefix: "_",
prefixSkip: ["is"],
exclude: ["map"],
alias: [
// ['camelCase', 'stringToCamelCase'], // => _StringToCamelCase
],
},
buildModules: ["unplugin-icons/nuxt", "./modules/apollo-module"],
components: {
dirs: [
{
path: "~/components",
extensions: ["vue", "tsx"],
},
{
path: "~/page-template",
extensions: ["vue"],
prefix: "Template",
},
],
},
imports: {
dirs: [
// Scan composables from nested directories
"composables/**",
"utils/**",
"graphql/**",
],
},
alias: {
dayjs: "dayjs/esm/",
},
build: {
transpile: [
"lodash-es",
"@ant-design/icons-vue",
"echarts",
"graphql",
isDev ? "" : "@babel/runtime", // building time: Could not resolve import "@babel/runtime/helpers/esm/objectSpread2.js"
],
},
css: ["~/assets/global.less"],
vite: {
ssr: {
noExternal: ["ant-design-vue", "dayjs"],
},
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
// https://www.antdv.com/docs/vue/customize-theme/#Ant-Design-Vue-Less-variables
modifyVars: antdTheme(),
},
},
},
define: {
// fixed apollo client err
__DEV__: isDev.toString(),
},
plugins: [
Components({
resolvers: [
IconsResolver({
prefix: "Icon",
}),
// resolveIcons true will error with NITRO_PRESET=cloudflare
AntDesignVueResolver({ resolveIcons: true, importStyle: "less" }),
],
dts: "types/components.d.ts",
}),
],
esbuild: isDev
? {}
: {
pure: !isDev ? ["console.log", "console.warn", "debugger"] : [],
legalComments: "none",
},
},
});