Files
OpenList-Frontend/vite.config.ts
Jad dce44631b7 feat: add libass-wasm as ASS subtitles renderer (#121)
* feat: add `libass-wasm` as ASS subtitles renderer

* style: specification type definition

* chore: less font file size with better visual effect

* chore: update package.json
2023-11-15 15:54:46 +08:00

58 lines
1.5 KiB
TypeScript

import path from "path"
import { defineConfig } from "vite"
import solidPlugin from "vite-plugin-solid"
import legacy from "@vitejs/plugin-legacy"
import { dynamicBase } from "vite-plugin-dynamic-base"
import copyPlugin from "rollup-plugin-copy"
export default defineConfig({
resolve: {
alias: {
"~": path.resolve(__dirname, "src"),
"@solidjs/router": path.resolve(__dirname, "solid-router/src"),
},
},
plugins: [
solidPlugin(),
legacy({
targets: ["defaults"],
}),
copyPlugin({
targets: [
{ src: "node_modules/libass-wasm/**/*.wasm", dest: "dist/assets" },
],
hook: "writeBundle",
}),
dynamicBase({
// dynamic public path var string, default window.__dynamic_base__
publicPath: " window.__dynamic_base__",
// dynamic load resources on index.html, default false. maybe change default true
transformIndexHtml: true,
}),
],
base: process.env.NODE_ENV === "production" ? "/__dynamic_base__/" : "/",
// base: "/",
build: {
// target: "es2015", //next
// polyfillDynamicImport: false,
},
// experimental: {
// renderBuiltUrl: (filename, { type, hostId, hostType }) => {
// if (type === "asset") {
// return { runtime: `window.ALIST.cdn/${filename}` };
// }
// return { relative: true };
// },
// },
server: {
host: "0.0.0.0",
proxy: {
"/api": {
target: "http://localhost:5244",
changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, ""),
},
},
},
})