mars3d&cesium library plugin for Vite
https://www.npmjs.com/package/vite-plugin-earth
小冰cc ccf0c9f6e3 | ||
---|---|---|
packages | ||
src | ||
.gitignore | ||
.npmrc | ||
.prettierrc | ||
LICENSE | ||
README.md | ||
package.json | ||
pnpm-lock.yaml | ||
pnpm-workspace.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 { cesiumPlugin } from 'vite-plugin-earth';
export default defineConfig({
plugins: [cesiumPlugin()]
});
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 { mars3dPlugin } from 'vite-plugin-earth';
export default defineConfig({
plugins: [mars3dPlugin()]
});
Options
useCDN
- Type :
object
- Default :
{ mars3d: '3.5.4', mars3dCesium: '1.104.3', turf: '6.5.0' }
打包时使用 cdn 方式
import { defineConfig } from 'vite';
import { mars3dPlugin } from 'vite-plugin-earth';
export default defineConfig({
plugins: [
mars3dPlugin({
useCDN: true
})
]
});
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