generated from spatie/package-skeleton-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
64 lines (57 loc) · 1.81 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
import { defineConfig, loadEnv } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';
import basicSsl from '@vitejs/plugin-basic-ssl';
import svgLoader from 'vite-svg-loader';
import path from "path";
import mkcert from 'vite-plugin-mkcert';
import DefineOptions from 'unplugin-vue-define-options/vite'
/** @type {import('vite').UserConfig} */
export default defineConfig(({ command, mode }) => {
const env = loadEnv(mode, process.cwd());
const extraPlugins = [];
if(env.VITE_HTTPS === 'true') {
extraPlugins.push(mkcert({
savePath: './.certs'
}) as Plugin);
}
if(env.VITE_HTTPS === 'fake') {
extraPlugins.push(basicSsl());
}
let publicDirectory = './build';
if(command === 'serve' && env.VITE_PROJECT_PUBLIC_DIRECTORY) {
publicDirectory = env.VITE_PROJECT_PUBLIC_DIRECTORY;
}
return {
plugins: [
vue({
reactivityTransform: true
}),
laravel({
hotFile: publicDirectory + '/director.hot',
input: ['resources/package/js/app.ts', 'resources/package/js/Icons/init.ts'],
refresh: true,
publicDirectory: publicDirectory,
buildDirectory: 'director/director'
}),
svgLoader(),
DefineOptions(),
...extraPlugins
],
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "@micheljonkman/laravel-director/scss/variables.scss";`,
},
}
},
resolve:{
alias:{
'~' : path.resolve(__dirname, './resources/package')
},
},
server: {
host: env.VITE_HOST
},
};
});