forked from Inventoros/Inventoros
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
49 lines (44 loc) · 1.34 KB
/
vite.config.js
File metadata and controls
49 lines (44 loc) · 1.34 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
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';
import { readdirSync, existsSync } from 'fs';
import { resolve } from 'path';
// Dynamically discover plugin entry points
function getPluginEntryPoints() {
const pluginsDir = resolve(__dirname, 'plugins');
const entryPoints = [];
if (existsSync(pluginsDir)) {
const plugins = readdirSync(pluginsDir, { withFileTypes: true })
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name);
plugins.forEach(plugin => {
const pluginJsPath = resolve(pluginsDir, plugin, 'resources/js/app.js');
if (existsSync(pluginJsPath)) {
entryPoints.push(pluginJsPath);
}
});
}
return entryPoints;
}
export default defineConfig({
plugins: [
laravel({
input: ['resources/js/app.js', ...getPluginEntryPoints()],
refresh: true,
}),
vue({
template: {
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
},
}),
],
resolve: {
alias: {
'@': resolve(__dirname, 'resources/js'),
'@plugins': resolve(__dirname, 'plugins'),
},
},
});