-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
项目首次渲染,cesium.js过大导致页面加载过慢 #40
Comments
我觉得没啥办法,想用他类库就要先加载它吧 |
我是在子页面用到的,但这个资源首页就加载了😂 |
哦,应该没有考虑过这个,首页默认会有一个<script src="...cesium"> ,不知道加一个 type="module" 会不会延迟加载? |
目前(<2023-02-04 Sat 15:43:33 UTC+08:00>)我是这样操作的来避免首页加载Cesium.js的:
但所有页面仍都会加载cesium/Widgets/widgets.css,需求点是让Cesium库只在相应页面加载。 src/main.js: import { createRouter, createWebHashHistory } from "vue-router";
const Home = function () {
return import("./Home.vue");
};
const Map = function () {
return import("./Map.vue");
};
const routes = [
{ path: "/", component: Home },
{ path: "/map", component: Map },
];
const router = createRouter({ history: createWebHashHistory(), routes });
app.use(router); vite.config.js: import cesium from "vite-plugin-cesium";
plugins.push(cesium({ rebuildCesium: true })); |
大佬,可以写个回调进去吗?在cesiumjs加载完时触发这个回调函数? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
如题,这种大文件首次加载怎么在vite里边处理呢,或者说怎么让它懒加载?
The text was updated successfully, but these errors were encountered: