Frustum Geometry working with Craco but not with Vite, Please Guide if someone has faced same situation?


Above one is Craco Image

Above one is Vite Image

Hey @Zahid_Khan, sorry you’re having issues.

I’m not really familiar with Craco so I can’t really help with the specifics there. Would you be able to share more about your configuration? Is it the same application in both instances?

We have a dedicated vite build example using CesiumJS. Maybe looking at the configs we recommend can help you. GitHub - CesiumGS/cesium-vite-example: The minimal recommended setup for an application using Cesium with Vite.

Here is my vite configs:

import { defineConfig } from ‘vite’;
import react from ‘@vitejs/plugin-react’;
import cesium from ‘vite-plugin-cesium’;
import { viteStaticCopy } from ‘vite-plugin-static-copy’;

const cesiumSource = ‘node_modules/cesium/Build/Cesium’;
const cesiumBaseUrl = ‘cesium’;

export default defineConfig({
plugins: [
react({
include: [‘/*.jsx’, '/.js’, '**/.tsx’, ‘**/*.ts’],
babel: {
plugins: [
[‘@babel/plugin-transform-react-jsx’, { runtime: ‘automatic’ }]
]
}
}),
cesium(),
viteStaticCopy({
targets: [
{ src: ${cesiumSource}/Workers, dest: cesiumBaseUrl },
{ src: ${cesiumSource}/Assets, dest: cesiumBaseUrl },
{ src: ${cesiumSource}/Widgets, dest: cesiumBaseUrl },
{ src: ${cesiumSource}/ThirdParty, dest: cesiumBaseUrl },
],
}),
],
define: {
CESIUM_BASE_URL: JSON.stringify(cesiumBaseUrl),
},
server: {
port: 3000,
proxy: {
‘/api’: ‘http://localhost:5000’,
},
},
resolve: {
alias: {
‘@’: ‘/src’,
},
},
optimizeDeps: {
exclude: [‘react-virtualized’],
include: [‘prop-types’],
},
build: {
assetsInlineLimit: 0,
commonjsOptions: {
include: [/react-virtualized/, /node_modules/],
},
chunkSizeWarningLimit: 1600,
},
});

I figured out this , @jjspace problem arises when i upload 3D Tileset but its not rendering the map in 3D view , dont know if cesium need specific config with vite while i have shared my configs with you … Sharing you pictures where on Craco is rendering 3D map with tileset while vite not with same tileset.


@Zahid_Khan the only configuration that I know is needed for Vite is what is shown in our vite example. The vite-plugin-cesium library is not created or maintained by us. I’m not familiar with what it’s doing so there’s a chance it’s modifying the build somehow?

I’m not as well versed in the other parts of your config to suggest anything else for certain. The server + proxy sticks out as a possibility of not letting it load the data correctly depending how you’re fetching it.

Are you getting any errors in the app? I would not expect it to just not render without some errors or failed network requests. It’s possible it’s a cesium bug but since it works with the CRACO configuration I suspect it’s something int he build process.

One of the same kind problem is faced by a user , i am sharing a link but no solution is given to him at all.

The demo repo share by cesium vite plugin creator have a plugin of cesium and she’s claiming for creating it.