npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vite-plugin-mars3d

v4.2.0

Published

Mars3D 在 Vite 平台的插件

Downloads

488

Readme

vite-plugin-mars3d使用说明

安装

//安装mars3d主库
npm install mars3d mars3d-cesium @turf/turf --save

//安装vite插件
npm install vite-plugin-mars3d --save

配置

vite.config.ts中引入plugin插件

import { defineConfig } from 'vite';
import { mars3dPlugin } from 'vite-plugin-mars3d';

export default defineConfig({
  plugins: [mars3dPlugin()]
});

如果你个性化需求,也可以按需传入参数

import { defineConfig } from 'vite';
import { mars3dPlugin } from 'vite-plugin-mars3d';

export default defineConfig({
  plugins: [
      mars3dPlugin({
        mars3dPackageName: "mars3d",
        mars3dRunPath: "mars3d",//目录名称
        cesiumPackageName: "mars3d-cesium",
        cesiumRunPath: "mars3d-cesium",//目录名称
        useStatic: false,
        useCDN: false
      }),
  ]
});

使用原生cesium时

  1. 不要安装mars3d-cesium包,仅安装cesium包,就是不能同时存在2个cesium包 package.json文件示例:
  "dependencies": {
    "cesium": "^1.118.0",
    "mars3d": "^3.7.20",
    "mars3d-space": "^3.7.20",
    "rollup": "^2.79.1",
    "vue": "^3.2.47"
  },
  "devDependencies": {
    "vite": "^4.2.0",
    "vite-plugin-mars3d": "^4.1.0",
    "@vitejs/plugin-vue": "^4.1.0",
    "typescript": "^4.9.3",
    "vue-tsc": "^1.2.0"
  }
  1. vite.config中引入时使用配置 mars3dPlugin({ cesiumPackageName: "cesium" })

vite.config.ts文件示例:

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { mars3dPlugin } from "vite-plugin-mars3d"; // 引入插件


export default defineConfig({
  plugins: [
    vue(),
    mars3dPlugin({ cesiumPackageName: "cesium" }), // 使用cesium原生包
  ],
});

参考

https://github.com/nshen/vite-plugin-cesium

常见问题

  • 如果项目的 package.json 没有 type:"module" ,请使用 "vite-plugin-mars3d":"~3.1.3"
  • 如果项目的 package.json 有 type:"module" 直接用最新版本即可。
  • 如果无法排除解决问题,也可以在vite.config.ts配置改为静态引入 mars3dPlugin({ useStatic: true })

Mars3D 是什么

Mars3D平台火星科技研发的一款基于 WebGL 技术实现的三维客户端开发平台,基于Cesium优化提升与 B/S 架构设计,支持多行业扩展的轻量级高效能 GIS 开发平台,能够免安装、无插件地在浏览器中高效运行,并可快速接入与使用多种 GIS 数据和三维模型,呈现三维空间的可视化,完成平台在不同行业的灵活应用。

Mars3D 平台可用于构建无插件、跨操作系统、 跨浏览器的三维 GIS 应用程序。平台使用 WebGL 来进行硬件加速图形化,跨平台、跨浏览器来实现真正的动态大数据三维可视化。通过 Mars3D 产品可快速实现浏览器和移动端上美观、流畅的三维地图呈现与空间分析。

相关网站

版权说明

  1. Mars3D 平台由火星科技自主研发,拥有所有权利。
  2. 任何个人或组织可以在遵守相关要求下可以免费无限制使用。