
Security News
Node.js TSC Votes to Stop Distributing Corepack
Corepack will be phased out from future Node.js releases following a TSC vote.
vite-plugin-cesium
Advanced tools
Easily set up a Cesium
project in Vite
.
update: if you just wanna a scaffolding by using this plugin, try a simply command yarn create cesium
, click create-cesium for more info.
Chinese tutorial: 中文教程
npm i cesium vite-plugin-cesium vite -D
# yarn add cesium vite-plugin-cesium vite -D
add this plugin to vite.config.js
import { defineConfig } from 'vite';
import cesium from 'vite-plugin-cesium';
export default defineConfig({
plugins: [cesium()]
});
add dev command to package.json
"scripts": {
"dev": "vite",
"build": "vite build"
}
run:
yarn dev
rebuildCesium
boolean
false
Default copy min cesium file to dist. if true
will rebuild cesium from source.
import { defineConfig } from 'vite';
import cesium from 'vite-plugin-cesium';
export default defineConfig({
plugins: [
cesium({
rebuildCesium: true
})
]
});
src/index.js
import { Viewer } from 'cesium';
import './css/main.css';
const viewer = new Viewer('cesiumContainer');
or if you like global Cesium object you can write as
import * as Cesium from 'cesium';
const viewer = new Cesium.Viewer('cesiumContainer');
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>cesium-vite</title>
<script type="module" src="/src/index.js"></script>
</head>
<body>
<div id="cesiumContainer"></div>
</body>
</html>
src/css/main.css
html,
body,
#cesiumContainer {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
Add dev
and build
commands to package.json
"scripts": {
"dev": "vite",
"build": "vite build"
},
Run yarn dev
For full demo project please check ./demo folder.
MIT
FAQs
Cesium library plugin for Vite
We found that vite-plugin-cesium demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Corepack will be phased out from future Node.js releases following a TSC vote.
Research
Security News
Research uncovers Black Basta's plans to exploit package registries for ransomware delivery alongside evidence of similar attacks already targeting open source ecosystems.
Security News
Oxlint's beta release introduces 500+ built-in linting rules while delivering twice the speed of previous versions, with future support planned for custom plugins and improved IDE integration.