mars3d&cesium library plugin for Vite
https://www.npmjs.com/package/vite-plugin-earth
小冰cc 4d2294e6b2 | ||
---|---|---|
demo-cesium | ||
demo-mars3d | ||
src | ||
.gitignore | ||
.npmrc | ||
.prettierrc | ||
LICENSE | ||
README.md | ||
package.json | ||
pnpm-lock.yaml | ||
tsconfig.json | ||
tsup.config.ts |
README.md
⚡ vite-plugin-earth
Easily set up a Cesium
& Mars3D
project in Vite
.
Cesium
Install
npm i cesium vite-plugin-earth vite -D
Usage
add this plugin to vite.config.js
import { defineConfig } from 'vite';
import earth from 'vite-plugin-earth';
export default defineConfig({
plugins: [earth()]
});
Mars3D
Install
npm i mars3d mars3d-cesium vite-plugin-earth vite -D
Usage
add this plugin to vite.config.js
import { defineConfig } from 'vite';
import earth from 'vite-plugin-earth';
export default defineConfig({
plugins: [earth({ useMars3D: true })]
});
Options
useCDN
- Type :
object
- Default :
{ mars3d: '3.5.0', mars3dCesium: '1.103.1', cesium: '1.103.0', turf: '6.5.0' }
打包时使用 cdn 方式
import { defineConfig } from 'vite';
import earth from 'vite-plugin-earth';
export default defineConfig({
plugins: [
earth({
useCDN: {}
})
]
});
Demo
Cesium
<div id="cesiumContainer"></div>
import { Viewer } from 'cesium';
const viewer = new Viewer('cesiumContainer');
Mars3D
<div id="mars3dContainer"></div>
import * as mars3d from 'mars3d';
import 'mars3d/dist/mars3d.css';
const map = new mars3d.Map('mars3dContainer', {});
License
MIT