-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.tizen.js
More file actions
73 lines (71 loc) · 1.95 KB
/
vite.config.tizen.js
File metadata and controls
73 lines (71 loc) · 1.95 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
import { defineConfig } from "vite";
import solidPlugin from "vite-plugin-solid";
import hexColorTransform from "@lightningtv/vite-hex-transform";
import path from "path";
/**
* Injects an inline queueMicrotask polyfill as the very first <script> in
* <head>. Chrome 69 (Tizen 5/6) doesn't have queueMicrotask (landed in
* Chrome 71), so this must execute before any app code.
*/
function queueMicrotaskPolyfillPlugin() {
const polyfill = `if(typeof queueMicrotask!=='function'){self.queueMicrotask=function(fn){Promise.resolve().then(fn).catch(function(e){setTimeout(function(){throw e},0);});};}`;
return {
name: "queue-microtask-polyfill",
transformIndexHtml(html) {
return html.replace("<head>", `<head>\n <script>${polyfill}</script>`);
}
};
}
export default defineConfig(({ mode }) => ({
define: {
__DEV__: mode !== "production",
__RTT__: false,
__renderTextBatching__: true,
__enableCompressedTextures__: false,
__calculateFps__: true,
LIGHTNING_DOM_RENDERING: false
},
plugins: [
queueMicrotaskPolyfillPlugin(),
hexColorTransform({
include: ["src/**/*.{ts,tsx,js,jsx}"]
}),
solidPlugin({
solid: {
moduleName: "@solidtv/solid",
generate: "universal",
builtIns: []
}
})
],
build: {
// Tizen 5/6 runs Chromium 69 — target it explicitly so esbuild
// downlevels optional chaining, nullish coalescing, etc.
target: "chrome69",
modulePreload: false,
rollupOptions: {
output: {
format: "iife"
}
},
minify: false,
sourcemap: false
},
resolve: {
alias: {
theme: path.resolve(__dirname, "src/theme.ts")
},
conditions: ["@solidtv/source"],
dedupe: [
"solid-js",
"solid-js/universal",
"@solidjs/router",
"@solidtv/renderer",
"@solidtv/solid",
"@solidtv/solid/primitives"
]
},
optimizeDeps: {
exclude: ["@solidtv/solid", "@solidtv/renderer"]
}
}));