Skip to content
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

Create new simple example with vue2 and vite #11306

Closed
brunokunace opened this issue May 24, 2023 · 8 comments
Closed

Create new simple example with vue2 and vite #11306

brunokunace opened this issue May 24, 2023 · 8 comments

Comments

@brunokunace
Copy link

Hi everyone, im trying to create a simple example with vue2+vite and cesium 1.105.2

I use a vite plugin to copy node files to public:

//vite.config.js

import copy from "rollup-plugin-copy";
...

      copy({
          targets: [
              { src: "node_modules/@cesium/engine/Source/*", dest: "public/" },
              { src: "node_modules/@cesium/engine/Source/WorkersES6/*", dest: "public/Workers" },
              { src: "node_modules/@cesium/widgets/Source/*", dest: "public/Widgets" },
          ],
          hook: 'buildStart'
      })

and all files i need are copied to /public folder and its nice.

But when i try to initialize the script bellow, i receive these erros in console and the result a black sky with start moving

//Hello world example code used

      Cesium.Ion.defaultAccessToken = CESIUM_KEY

      const viewer = new Cesium.Viewer('cesiumContainer');

Error:
Note. /Workers/createVerticesFromHeightmap.js is working in the indicated path.

image

Result screen:
image

@TJKoury
Copy link
Contributor

TJKoury commented May 24, 2023

It's out of date, but try this and post if it works:

https://www.npmjs.com/package/c137.js

@brunokunace
Copy link
Author

@TJKoury works, but its not a official Cesium package and i cant use this. @cesiumgs-admin

@TJKoury
Copy link
Contributor

TJKoury commented May 24, 2023

#10619

I submitted for a Cesium grant to roll all this into Cesium, make some noise if this is something you want to see done.

@ggetz
Copy link
Contributor

ggetz commented May 26, 2023

@brunokunace You'll want to use the pre-built workers in Build/Workers/ instead of the unbuilt Source/WorkersES6/.

But message received about an easy-to-follow example using vue/vite.

CC #11301

@mivui
Copy link

mivui commented Aug 26, 2023

@ggetz
Copy link
Contributor

ggetz commented Oct 24, 2023

@s3xysteak
Copy link
Contributor

s3xysteak commented Oct 26, 2023

@brunokunace I found maybe a good solution to solve the problem. Here is the code simply-cesium-vite-vue. Hope it helpful.
On my laptop, the bundling process only took 717ms, and the resulting "dist" folder was only 11.1 MB in size.
I have provided a detailed explanation of my approach in the readme. If there's anything I can assist you with, please feel free to ask. If you have any suggestions or improvements, I welcome them as well!

@ggetz
Copy link
Contributor

ggetz commented Jan 19, 2024

Hi all, we've added https://github.com/CesiumGS/cesium-vite-example with a recommended setup for vite. It should also be straightforward to add vue to that setup.

Please leave a comment or issue in that repo if you have any feedback. Thanks!

@ggetz ggetz closed this as completed Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants