-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.js
43 lines (40 loc) · 1.16 KB
/
vite.config.js
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
import { dirname, resolve } from 'path';
import { fileURLToPath } from 'url';
import { sveltekit } from '@sveltejs/kit/vite';
import legacy from '@vitejs/plugin-legacy';
import packageConfig from './package.json';
const __dirname = dirname(fileURLToPath(import.meta.url));
/**
*
* @param {string} path
* @returns
*/
const localPath = (path) => resolve(__dirname, path);
/** @type {import('vite').UserConfig} */
const config = {
plugins: [
sveltekit(),
legacy({
// For complete list of available options, see:
// https://www.npmjs.com/package/@vitejs/plugin-legacy#Options
targets: packageConfig.browserslist,
additionalLegacyPolyfills: [
'custom-event-polyfill',
'core-js/modules/es.promise.js',
'whatwg-fetch',
// 'global-this' should be used so 'regenerator-runtime' wouldn't do CSP issues
'core-js/proposals/global-this',
'regenerator-runtime/runtime',
'unorm',
'path-composedpath-polyfill',
'proxy-polyfill/proxy.min.js',
localPath('polyfills/initKeyboardeventKeyPolyfill.js'),
localPath('polyfills/formdata.js')
],
modernPolyfills: [
'es.array.at'// For Safary
]
}),
]
};
export default config;