-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
68 lines (67 loc) · 1.98 KB
/
vite.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
import { fileURLToPath, URL } from "url";
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { resolve, dirname } from 'node:path';
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
import {vitePluginGraphqlLoader} from "vite-plugin-graphql-loader";
import {sassMigratorQuasar} from "rollup-plugin-sass-migrator";
import type { Plugin } from "vite";
interface SourcemapExclude {
excludeNodeModules?: boolean;
}
export function sourcemapExclude(opts?: SourcemapExclude): Plugin {
return {
name: "sourcemap-exclude",
transform(code: string, id: string) {
if (opts?.excludeNodeModules && id.includes("node_modules")) {
return {
code,
// https://github.com/rollup/rollup/blob/master/docs/plugin-development/index.md#source-code-transformations
map: { mappings: "" },
};
}
},
};
}
// https://vitejs.dev/config/
export default defineConfig({
root: './front',
base: '/hrm/',
publicPath: '/',
plugins: [
sassMigratorQuasar({
indexPath: 'node_modules/quasar/dist/quasar.sass',
debug: false,
dryRun: false
}),
vue(),
VueI18nPlugin({
runtimeOnly: false,
strictMessage: false,
include: resolve(dirname(fileURLToPath(import.meta.url)), './front/i18n/**'),
}),
vitePluginGraphqlLoader()
],
server: {
host: "0.0.0.0",
port: 3000
},
build: {
outDir: '../dist/public',
rollupOptions: {
output: {
manualChunks: (id) => {
if (id.includes("node_modules")) {
return "vendor";
}
},
},
},
target: 'esnext'
},
resolve: {
alias: [
{ find: '@', replacement: fileURLToPath(new URL('./front', import.meta.url)) }
],
}
})