-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathvite.config.js
More file actions
76 lines (74 loc) · 1.87 KB
/
Copy pathvite.config.js
File metadata and controls
76 lines (74 loc) · 1.87 KB
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
import { defineConfig } from 'vite';
import { readdirSync, statSync } from 'fs';
import { resolve } from 'path';
import { fileURLToPath } from 'url';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';
import laravelTranslations from 'vite-plugin-laravel-translations';
import Components from 'unplugin-vue-components/vite';
import { BootstrapVueNextResolver } from 'bootstrap-vue-next';
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const bvnSubdirs = ['components', 'directives'];
const bvnComponents = bvnSubdirs.flatMap(sub => {
const dir = resolve(__dirname, `node_modules/bootstrap-vue-next/dist/src/${sub}`);
return readdirSync(dir)
.filter(name => statSync(resolve(dir, name)).isDirectory())
.map(name => `bootstrap-vue-next/${sub}/${name}`);
});
export default defineConfig({
server: {
host: true,
origin: 'http://localhost:5173',
watch: {
ignored: ['**/.env*'],
},
allowedHosts: [
'localhost',
],
cors: {
origin: [
'http://localhost:5173',
'http://localhost',
],
},
},
optimizeDeps: {
include: bvnComponents,
},
build: {
assetsInlineLimit: 0, // necessary so that Vite does not inline any images in prod, which would violate the CSP
},
plugins: [
laravel({
input: [
'resources/sass/app.scss',
'resources/js/app.js'
],
refresh: true,
}),
vue({
template: {
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
}
}),
laravelTranslations({
namespace: false,
absoluteLanguageDirectory: 'lang',
includeJson: true,
assertJsonImport: true,
}),
Components({
resolvers: [
BootstrapVueNextResolver(),
],
})
],
resolve: {
alias: {
'vue': 'vue/dist/vue.esm-bundler',
},
},
});