-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
86 lines (77 loc) · 2.25 KB
/
vite.config.ts
File metadata and controls
86 lines (77 loc) · 2.25 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
77
78
79
80
81
82
83
84
85
86
import replace from '@rollup/plugin-replace';
import react from '@vitejs/plugin-react-swc';
import laravel from 'laravel-vite-plugin';
import {defineConfig, Plugin} from 'vite';
import {VitePWA} from 'vite-plugin-pwa';
import tsconfigPaths from 'vite-tsconfig-paths';
// override laravel plugin base option (from absolute to relative to html base tag)
function basePath(): Plugin {
return {
name: 'test',
enforce: 'post',
config: () => {
return {
base: '',
};
},
};
}
export default defineConfig({
base: '',
resolve: {
preserveSymlinks: true,
},
build: {
sourcemap: true,
},
plugins: [
tsconfigPaths(),
react(),
laravel({
input: ['resources/client/main.tsx'],
refresh: false,
}),
basePath(),
replace({
preventAssignment: true,
__SENTRY_DEBUG__: false,
}),
VitePWA({
strategies: 'injectManifest',
srcDir: 'resources/client',
mode: 'development',
filename: 'sw.ts',
minify: false,
manifest: false,
injectRegister: false,
buildBase: '/build/',
scope: '/',
base: '/',
registerType: 'autoUpdate',
devOptions: {
enabled: false,
},
includeAssets: [],
workbox: {
// Add all the assets built by Vite into the public/build/assets
// folder to the SW cache.
globPatterns: ['**/*.{js,css,html,ico,jpg,png,svg,woff,woff2,ttf,eot}'],
navigateFallback: '/',
// Stops various paths being intercepted by the service worker
// if they're not available offline. Telescope is a good
// example, if you are using that.
navigateFallbackDenylist: [/^\/telescope/],
// Add some explicit URLs to the SW precache. This helps us
// work with the laravel/vite-plugin setup.
additionalManifestEntries: [
// Cache the root URL to get hold of the PWA HTML entrypoint
// defined in welcome.blade.php. Ref:
// https://github.com/vite-pwa/vite-plugin-pwa/issues/431#issuecomment-1703151065
{url: '/', revision: `${Date.now()}`},
{url: '/manifest.json', revision: `${Date.now()}`},
],
maximumFileSizeToCacheInBytes: 3000000, // 3MB
},
}),
],
});