-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathvite.config.js
More file actions
54 lines (52 loc) · 1.15 KB
/
vite.config.js
File metadata and controls
54 lines (52 loc) · 1.15 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
/* eslint-env node */
import { defineConfig } from 'vite';
import solidPlugin from 'vite-plugin-solid';
export default defineConfig({
plugins: [spaFallbackWithDot(), solidPlugin()],
preview: {
port: 3000,
},
server: {
port: 3000,
hmr: {
overlay: false,//To hide the overlay error message
},
},
build: {
target: 'esnext',
polyfillDynamicImport: false,
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: './setupVitest.js',
deps: {
inline: [/solid-js/, /solid-testing-library/],
},
},
resolve: {
conditions: ['development', 'browser'],
alias: {
'node-fetch': 'isomorphic-fetch',
},
},
});
/**
* Vite doesn't handle fallback html with dot (.), see https://github.com/vitejs/vite/issues/2415
* @returns {import("vite").Plugin}
*/
function spaFallbackWithDot() {
return {
name: 'spa-fallback-with-dot',
configureServer(server) {
return () => {
server.middlewares.use(function customSpaFallback(req, res, next) {
if (req.url.includes('.')) {
req.url = '/index.html';
}
next();
});
};
},
};
}