vite.config.js
1.59 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
import {defineConfig, loadEnv} from 'vite';
import vue from '@vitejs/plugin-vue';
import {vitePluginForArco} from '@arco-plugins/vite-vue'
import vitePluginOss from 'vite-plugin-oss';
import laravel from "./vite-laravel-plugin";
const ossPath = `asset${new Date()
.toLocaleString('zh')
.slice(0, 20)
.replace(/[\s/:]/g, '')}`
const config = loadEnv("", "");
export default defineConfig({
plugins: [
laravel({
assetUrl: config.VITE_ASSET_URL,
buildDirectory: 'vendor/web',
input: ['resources/js/app.ts'],
css: {preprocessorOptions: {less: {math: "always", relativeUrls: true, javascriptEnabled: true}}},
refresh: true
}),
vue({
template: {transformAssetUrls: {base: null, includeAbsolute: false}},
script: {defineModel: true}
}),
vitePluginForArco({style: 'css'}),
vitePluginOss({
from: `./public/vendor/web/${ossPath}/**`,
dist: `vendor/web`,
accessKeyId: config.VITE_OSS_ACCESS_KEY,
accessKeySecret: config.VITE_OSS_ACCESS_SECRET,
bucket: config.VITE_OSS_BUCKET,
region: config.VITE_OSS_REGION.replace('.aliyuncs.com', ''),
quitWpOnError: true,
deleteOrigin: true,
deleteEmptyDir: true
}),
],
resolve: {
alias: {
'@image': '/resources/image',
'@css': '/resources/css'
},
},
server: {
https: false
},
build: {
chunkSizeWarningLimit: 1024,
assetsDir: ossPath,
},
});