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
| import { defineConfig, loadEnv } from 'vite'
| import vueJsx from '@vitejs/plugin-vue-jsx'
| import path from 'path'
| import VueTypeImports from 'vite-plugin-vue-type-imports'
| import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
| import Components from 'unplugin-vue-components/vite'
| const nodeEnv = process.env.NODE_ENV || 'production'
| const env = loadEnv(nodeEnv, __dirname)
| // import { postcssIsolateStyles } from 'vitepress'
| // import tailwindcss from 'tailwindcss'
| // import autoprefixer from 'autoprefixer'
| const suffix = process.env.NODE_ENV === 'development' ? '' : '.ssr'
| console.log(suffix, 'suffix')
| export default defineConfig({
| ssr: {
| noExternal: ['element-plus'],
| },
| plugins: [
| vueJsx(),
| VueTypeImports(),
| Components({
| include: [/\.vue$/, /\.vue\?vue/, /\.md$/, /\.tsx/, /\.jsx/],
| resolvers: [
| ElementPlusResolver({
| importStyle: 'sass',
| }),
| ],
| }),
| ],
|
| resolve: {
| alias: {
| '@': path.resolve(__dirname, '../src'),
| components: path.resolve(__dirname, '../src/components'),
| sdk: path.resolve(__dirname, `../src/cms/sdk.es${suffix}.js`),
| },
| },
| server: {
| host: '0.0.0.0',
| headers: {
| 'Access-Control-Allow-Origin': '*',
| },
| origin: `//localhost:${env.VITE_PORT}`,
| // open: true,
| port: env.VITE_PORT,
| cors: true,
| proxy: {
| '/api': {
| target: env.VITE_API_URL,
| changeOrigin: true,
| },
| '/hubs': {
| target: env.VITE_API_URL,
| changeOrigin: true,
| ws: true,
| },
| },
| },
| build: {
| outDir: 'dist',
| sourcemap: false,
| chunkSizeWarningLimit: 1500,
| target: 'ES2022',
| rollupOptions: {},
| // output: {
| // entryFileNames: `index.js`,
| // },
| },
| css: {
| // postcss: {
| // plugins: [
| // postcssIsolateStyles({
| // includeFiles: [/vp-doc\.css/],
| // }),
| // tailwindcss(),
| // autoprefixer(),
| // ],
| // },
| preprocessorOptions: {
| scss: {
| additionalData: `
| @use "@/assets/styles/element.scss" as *;
| `,
| },
| },
| },
| })
|
|