Repository navigation
Expand file tree
/
Copy pathvite.config.js
More file actions
66 lines (63 loc) · 1.49 KB
/
Copy pathvite.config.js
File metadata and controls
66 lines (63 loc) · 1.49 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
import { defineConfig, loadEnv } from 'vite'
import laravel from 'laravel-vite-plugin'
import moonShineBuildPlugin from "./resources/js/moonshine-build";
import tailwindcss from "@tailwindcss/vite";
import path from 'path';
export default defineConfig(({mode}) => {
const env = loadEnv(mode, process.cwd())
return {
base: '/vendor/moonshine/',
resolve: {
alias: {
'@moonshine-resources': path.resolve(__dirname, '/resources'),
}
},
plugins: [
moonShineBuildPlugin(),
laravel({
input: ['resources/css/main.css', 'resources/js/app.js'],
refresh: true,
publicDirectory: 'dist'
}),
tailwindcss(),
],
server: {
host: env.VITE_SERVER_HOST,
hmr: {
host: env.VITE_SERVER_HMR_HOST,
},
...env.VITE_SERVER_CORS_ORIGIN ? {
cors: {
origin: env.VITE_SERVER_CORS_ORIGIN,
credentials: true
}
} : {}
},
css: {
devSourcemap: true,
preprocessorOptions: {
sass: {
quietDeps: true,
},
scss: {
quietDeps: true,
},
},
},
build: {
emptyOutDir: false,
outDir: 'dist',
rollupOptions: {
output: {
entryFileNames: `assets/[name].js`,
assetFileNames: chunk => {
if (chunk.name.endsWith('.woff2')) {
return 'fonts/[name].[ext]'
}
return 'assets/[name].css'
},
},
},
}
}
})