mirror of https://github.com/halo-dev/halo-admin
chore: global loading of base dependencies
parent
d8c14531e0
commit
690802c52a
32
index.html
32
index.html
|
@ -1,16 +1,20 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8"/>
|
||||||
<meta content="IE=edge" http-equiv="X-UA-Compatible" />
|
<meta content="IE=edge" http-equiv="X-UA-Compatible"/>
|
||||||
<meta content="webkit" name="renderer" />
|
<meta content="webkit" name="renderer"/>
|
||||||
<meta
|
<meta
|
||||||
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover"
|
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover"
|
||||||
name="viewport"
|
name="viewport"
|
||||||
/>
|
/>
|
||||||
<meta content="noindex,nofollow" name="robots" />
|
<meta content="noindex,nofollow" name="robots"/>
|
||||||
<title>Halo</title>
|
<title>Halo</title>
|
||||||
<link href="/favicon.ico" rel="icon" />
|
<link href="/favicon.ico" rel="icon"/>
|
||||||
|
<script src="./assets/vue/vue.global.js"></script>
|
||||||
|
<script src="./assets/vue-router/vue-router.global.js"></script>
|
||||||
|
<script src="./assets/admin-shared/halo-admin-shared.iife.js"></script>
|
||||||
|
<script src="./assets/components/halo-components.iife.js"></script>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -38,17 +42,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body class="themeable-default">
|
<body class="themeable-default">
|
||||||
<noscript>
|
<noscript>
|
||||||
<strong>
|
<strong>
|
||||||
We're sorry but halo admin client doesn't work properly without
|
We're sorry but halo admin client doesn't work properly without
|
||||||
JavaScript enabled. Please enable it to continue.
|
JavaScript enabled. Please enable it to continue.
|
||||||
</strong>
|
</strong>
|
||||||
</noscript>
|
</noscript>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<div id="loader"></div>
|
<div id="loader"></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="/src/main.ts" type="module"></script>
|
<script src="/src/main.ts" type="module"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -72,7 +72,9 @@
|
||||||
"typescript": "~4.7.3",
|
"typescript": "~4.7.3",
|
||||||
"vite": "^2.9.12",
|
"vite": "^2.9.12",
|
||||||
"vite-compression-plugin": "^0.0.4",
|
"vite-compression-plugin": "^0.0.4",
|
||||||
|
"vite-plugin-externals": "^0.5.0",
|
||||||
"vite-plugin-pwa": "^0.12.0",
|
"vite-plugin-pwa": "^0.12.0",
|
||||||
|
"vite-plugin-static-copy": "^0.5.1",
|
||||||
"vite-plugin-vue-setup-extend": "^0.4.0",
|
"vite-plugin-vue-setup-extend": "^0.4.0",
|
||||||
"vitest": "^0.15.1",
|
"vitest": "^0.15.1",
|
||||||
"vue-tsc": "^0.34.17"
|
"vue-tsc": "^0.34.17"
|
||||||
|
|
|
@ -44,7 +44,9 @@ importers:
|
||||||
typescript: ~4.7.3
|
typescript: ~4.7.3
|
||||||
vite: ^2.9.12
|
vite: ^2.9.12
|
||||||
vite-compression-plugin: ^0.0.4
|
vite-compression-plugin: ^0.0.4
|
||||||
|
vite-plugin-externals: ^0.5.0
|
||||||
vite-plugin-pwa: ^0.12.0
|
vite-plugin-pwa: ^0.12.0
|
||||||
|
vite-plugin-static-copy: ^0.5.1
|
||||||
vite-plugin-vue-setup-extend: ^0.4.0
|
vite-plugin-vue-setup-extend: ^0.4.0
|
||||||
vitest: ^0.15.1
|
vitest: ^0.15.1
|
||||||
vue: ^3.2.37
|
vue: ^3.2.37
|
||||||
|
@ -100,7 +102,9 @@ importers:
|
||||||
typescript: 4.7.3
|
typescript: 4.7.3
|
||||||
vite: 2.9.12_sass@1.52.3
|
vite: 2.9.12_sass@1.52.3
|
||||||
vite-compression-plugin: 0.0.4
|
vite-compression-plugin: 0.0.4
|
||||||
|
vite-plugin-externals: 0.5.0_vite@2.9.12
|
||||||
vite-plugin-pwa: 0.12.0_vite@2.9.12
|
vite-plugin-pwa: 0.12.0_vite@2.9.12
|
||||||
|
vite-plugin-static-copy: 0.5.1_vite@2.9.12
|
||||||
vite-plugin-vue-setup-extend: 0.4.0_vite@2.9.12
|
vite-plugin-vue-setup-extend: 0.4.0_vite@2.9.12
|
||||||
vitest: 0.15.1_fiumxgyk2tfafw3c4rsaverrnm
|
vitest: 0.15.1_fiumxgyk2tfafw3c4rsaverrnm
|
||||||
vue-tsc: 0.34.17_typescript@4.7.3
|
vue-tsc: 0.34.17_typescript@4.7.3
|
||||||
|
@ -3529,6 +3533,10 @@ packages:
|
||||||
unbox-primitive: 1.0.2
|
unbox-primitive: 1.0.2
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/es-module-lexer/0.4.1:
|
||||||
|
resolution: {integrity: sha512-ooYciCUtfw6/d2w56UVeqHPcoCFAiJdz5XOkYpv/Txl1HMUozpXjz/2RIQgqwKdXNDPSF1W7mJCFse3G+HDyAA==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/es-to-primitive/1.2.1:
|
/es-to-primitive/1.2.1:
|
||||||
resolution: {integrity: sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==}
|
resolution: {integrity: sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
|
@ -4219,6 +4227,15 @@ packages:
|
||||||
universalify: 2.0.0
|
universalify: 2.0.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/fs-extra/10.1.0:
|
||||||
|
resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dependencies:
|
||||||
|
graceful-fs: 4.2.9
|
||||||
|
jsonfile: 6.1.0
|
||||||
|
universalify: 2.0.0
|
||||||
|
dev: true
|
||||||
|
|
||||||
/fs-extra/7.0.1:
|
/fs-extra/7.0.1:
|
||||||
resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==}
|
resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==}
|
||||||
engines: {node: '>=6 <7 || >=8'}
|
engines: {node: '>=6 <7 || >=8'}
|
||||||
|
@ -6770,6 +6787,18 @@ packages:
|
||||||
- supports-color
|
- supports-color
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/vite-plugin-externals/0.5.0_vite@2.9.12:
|
||||||
|
resolution: {integrity: sha512-y7SPpHGLSk5ELCbK0SBRJrEr2OuPFxCOKIVkrFECukp9w8hZwh3teCHo2U2UmJ8UHKUP7BoOhTw2DFRbq3GJfQ==}
|
||||||
|
peerDependencies:
|
||||||
|
vite: ^2.0.0
|
||||||
|
dependencies:
|
||||||
|
acorn: 8.7.1
|
||||||
|
es-module-lexer: 0.4.1
|
||||||
|
fs-extra: 10.0.1
|
||||||
|
magic-string: 0.25.9
|
||||||
|
vite: 2.9.12_sass@1.52.3
|
||||||
|
dev: true
|
||||||
|
|
||||||
/vite-plugin-pwa/0.12.0_vite@2.9.12:
|
/vite-plugin-pwa/0.12.0_vite@2.9.12:
|
||||||
resolution: {integrity: sha512-KYD+cnS5ExLF3T28NkfzBLZ53ehHlp+qMhHGFNh0zlVGpFHrJkL2v9wd4AMi7ZkBTffgeNatIFiv8rhCsMSxBQ==}
|
resolution: {integrity: sha512-KYD+cnS5ExLF3T28NkfzBLZ53ehHlp+qMhHGFNh0zlVGpFHrJkL2v9wd4AMi7ZkBTffgeNatIFiv8rhCsMSxBQ==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
|
@ -6787,6 +6816,19 @@ packages:
|
||||||
- supports-color
|
- supports-color
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/vite-plugin-static-copy/0.5.1_vite@2.9.12:
|
||||||
|
resolution: {integrity: sha512-jRB+TzYUc93lSCRb0xKCJNAjaYb1LwHoLVPsz7cqFN2kDybwLsDpayUzPiNSn1Nb8lX5aoZ5Az/gV9zQu3t8dg==}
|
||||||
|
engines: {node: '>=12.2'}
|
||||||
|
peerDependencies:
|
||||||
|
vite: ^2.6.14
|
||||||
|
dependencies:
|
||||||
|
chokidar: 3.5.3
|
||||||
|
fast-glob: 3.2.11
|
||||||
|
fs-extra: 10.1.0
|
||||||
|
picocolors: 1.0.0
|
||||||
|
vite: 2.9.12_sass@1.52.3
|
||||||
|
dev: true
|
||||||
|
|
||||||
/vite-plugin-vue-setup-extend/0.4.0_vite@2.9.12:
|
/vite-plugin-vue-setup-extend/0.4.0_vite@2.9.12:
|
||||||
resolution: {integrity: sha512-WMbjPCui75fboFoUTHhdbXzu4Y/bJMv5N9QT9a7do3wNMNHHqrk+Tn2jrSJU0LS5fGl/EG+FEDBYVUeWIkDqXQ==}
|
resolution: {integrity: sha512-WMbjPCui75fboFoUTHhdbXzu4Y/bJMv5N9QT9a7do3wNMNHHqrk+Tn2jrSJU0LS5fGl/EG+FEDBYVUeWIkDqXQ==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
|
|
|
@ -58,16 +58,18 @@ function loadCoreModules() {
|
||||||
coreModules.forEach(registerModule);
|
coreModules.forEach(registerModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPluginModules() {
|
async function loadPluginModules() {
|
||||||
// TODO: load plugin modules
|
// TODO: load plugin modules
|
||||||
}
|
}
|
||||||
|
|
||||||
initApp();
|
(async function () {
|
||||||
|
await initApp();
|
||||||
|
})();
|
||||||
|
|
||||||
async function initApp() {
|
async function initApp() {
|
||||||
try {
|
try {
|
||||||
loadCoreModules();
|
loadCoreModules();
|
||||||
loadPluginModules();
|
await loadPluginModules();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,54 @@
|
||||||
import { fileURLToPath, URL } from "url";
|
import { fileURLToPath, URL } from "url";
|
||||||
|
|
||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import Vue from "@vitejs/plugin-vue";
|
import Vue from "@vitejs/plugin-vue";
|
||||||
import VueJsx from "@vitejs/plugin-vue-jsx";
|
import VueJsx from "@vitejs/plugin-vue-jsx";
|
||||||
import VueSetupExtend from "vite-plugin-vue-setup-extend";
|
import VueSetupExtend from "vite-plugin-vue-setup-extend";
|
||||||
import Compression from "vite-compression-plugin";
|
import Compression from "vite-compression-plugin";
|
||||||
import { VitePWA } from "vite-plugin-pwa";
|
import { VitePWA } from "vite-plugin-pwa";
|
||||||
|
import { viteExternalsPlugin as ViteExternals } from "vite-plugin-externals";
|
||||||
|
import { viteStaticCopy as ViteStaticCopy } from "vite-plugin-static-copy";
|
||||||
|
|
||||||
export default defineConfig({
|
export default ({ mode }: { mode: string }) => {
|
||||||
|
const isProduction = mode === "production";
|
||||||
|
|
||||||
|
return defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
Vue(),
|
Vue(),
|
||||||
VueJsx(),
|
VueJsx(),
|
||||||
VueSetupExtend(),
|
VueSetupExtend(),
|
||||||
Compression(),
|
Compression(),
|
||||||
|
ViteExternals({
|
||||||
|
vue: "Vue",
|
||||||
|
"vue-router": "VueRouter",
|
||||||
|
"@halo-dev/shared": "HaloAdminShared",
|
||||||
|
"@halo-dev/components": "HaloComponents",
|
||||||
|
}),
|
||||||
|
ViteStaticCopy({
|
||||||
|
targets: [
|
||||||
|
{
|
||||||
|
src: `./node_modules/vue/dist/vue.global${
|
||||||
|
isProduction ? ".prod" : ""
|
||||||
|
}.js`,
|
||||||
|
dest: "assets/vue",
|
||||||
|
rename: "vue.global.js",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: `./node_modules/vue-router/dist/vue-router.global${
|
||||||
|
isProduction ? ".prod" : ""
|
||||||
|
}.js`,
|
||||||
|
dest: "assets/vue-router",
|
||||||
|
rename: "vue-router.global.js",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: "./node_modules/@halo-dev/admin-shared/dist/halo-admin-shared.iife.js",
|
||||||
|
dest: "assets/admin-shared",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: "./node_modules/@halo-dev/components/dist/halo-components.iife.js",
|
||||||
|
dest: "assets/components",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
VitePWA({
|
VitePWA({
|
||||||
manifest: {
|
manifest: {
|
||||||
name: "Halo",
|
name: "Halo",
|
||||||
|
@ -35,4 +71,5 @@ export default defineConfig({
|
||||||
web: [/\.[jt]sx$/],
|
web: [/\.[jt]sx$/],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue