-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathvite.config.js
More file actions
77 lines (70 loc) · 1.77 KB
/
Copy pathvite.config.js
File metadata and controls
77 lines (70 loc) · 1.77 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
// noinspection NpmUsedModulesInstalled,JSUnusedLocalSymbols,JSUnusedGlobalSymbols,JSValidateTypes
import { resolve } from 'path'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import { sveltekit } from '@sveltejs/kit/vite'
// import sveltePreprocess from 'svelte-preprocess'
// import autoprefixer from 'autoprefixer'
import legacy from '@vitejs/plugin-legacy'
import 'dotenv/config'
const isDevelopment = process.env.NODE_ENV === 'development'
const isProduction = process.env.NODE_ENV === 'production'
const GlobalDebug = process.env.GLOBAL_DEBUG === 'true'
const BuildComponents = process.env.BUILD_COMPONENTS === 'true'
const BuildWeb = process.env.BUILD_WEBSITE === 'true'
const BuildDesktop = process.env.BUILD_DESKTOP === 'true'
const useBabel = false
const sourceMapsInProduction = true
/** @type {import('vite').UserConfig} */
const SvelteKitConfig = {
plugins: [
sveltekit()
],
build: {
sourcemap: isProduction && sourceMapsInProduction
},
css: {
preprocessorOptions: {
scss: {
additionalData: '@use "src/variables.scss" as *;'
}
}
}
}
/** @type {import('vite').UserConfig} */
const SvelteConfig = {
plugins: [
svelte({
compilerOptions: {
customElement: true
}
}),
useBabel && legacy({
targets: ['defaults', 'IE 11']
})
],
publicDir: 'www',
build: {
outDir: 'components',
assetsDir: 'emuos/components',
sourcemap: sourceMapsInProduction,
rollupOptions: {
input: {
main: resolve(__dirname, 'components.html')
}
}
},
css: {
preprocessorOptions: {
scss: {
additionalData: '@use "src/variables.scss" as *;'
}
}
},
resolve:{
alias:{
'$lib' : resolve(__dirname, 'src/lib')
}
}
}
const config = BuildWeb || BuildDesktop ? SvelteKitConfig : (BuildComponents ? SvelteConfig : {})
export default config