Prepare production smart scale Android app
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
|
||||
export default defineConfig({
|
||||
base: "./",
|
||||
plugins: [
|
||||
react(),
|
||||
{
|
||||
// Android 7.1 的旧版 WebView 不能直接执行 module 脚本。
|
||||
name: "android-7-classic-script",
|
||||
transformIndexHtml: {
|
||||
order: "post",
|
||||
handler(html) {
|
||||
return html.replace(
|
||||
/<script type="module" crossorigin src="([^"]+)"><\/script>/,
|
||||
'<script defer src="$1"></script>',
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
resolve: {
|
||||
dedupe: ["react", "react-dom"],
|
||||
},
|
||||
build: {
|
||||
// 生产终端为 Android 7.1,内置 Chromium WebView 52。
|
||||
target: "chrome52",
|
||||
cssTarget: "chrome52",
|
||||
sourcemap: false,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user