Globe loading local in dev, but not on CDN (SvelteJS)

I can’t find the flaw. The globe loads like normal in npm run dev.
When i upload it to CDN, the globe does not come up.

I have this struggle from the change to 1.100.0 on, when the pathes changed. I changed the pathes and made it running, but didnt notice that its not running on CDN, but only in my dev environment.

Any help appreciated. I’m struggeling since weeks.

Hi @worldpeaceenginelabs,

Can you give us some more details here? For instance, what is the difference between the configuration your dev builds and production builds?

My hypothesis would be that the workers are not loading correctly, which would prevent the globe from showing up. Are there any errors in the console?

Hi Gabby,

Thank you for your fast feedback. This is my build log on Cloudflare. I hope that helps.

Does cesiumjs need a minimum version of node? (my version in dev is v20.12.0, on the CDN it’s 14.18.0. Just noticing this now)

Update: The Cloudflare build now uses v20.12.0, but the globe still doesn’t come up on CDN.

2024-05-09T08:23:02.364574Z	Cloning repository...
2024-05-09T08:23:03.060525Z	From https://github.com/worldpeaceenginelabs/METAVERSE-DAO_CLOUD-ATLAS
2024-05-09T08:23:03.061083Z	 * branch            21827a5ce46582781c911645f7872f89322635cc -> FETCH_HEAD
2024-05-09T08:23:03.061174Z	
2024-05-09T08:23:03.143693Z	HEAD is now at 21827a5 tempfiles error fix tryout
2024-05-09T08:23:03.144174Z	
2024-05-09T08:23:03.229492Z	
2024-05-09T08:23:03.251906Z	Success: Finished cloning repository files
2024-05-09T08:23:04.800875Z	Checking for configuration in a wrangler.toml configuration file (BETA)
2024-05-09T08:23:04.801461Z	
2024-05-09T08:23:04.925663Z	No wrangler.toml file found. Continuing.
2024-05-09T08:23:05.017882Z	Installing dependencies
2024-05-09T08:23:05.023168Z	Python version set to 2.7
2024-05-09T08:23:07.042059Z	Downloading and installing node v14.18.0...
2024-05-09T08:23:07.2674Z	Downloading https://nodejs.org/dist/v14.18.0/node-v14.18.0-linux-x64.tar.xz...
2024-05-09T08:23:07.701813Z	Computing checksum with sha256sum
2024-05-09T08:23:07.813296Z	Checksums matched!
2024-05-09T08:23:10.371089Z	Now using node v14.18.0 (npm v6.14.15)
2024-05-09T08:23:10.572797Z	Started restoring cached build plugins
2024-05-09T08:23:10.580938Z	Finished restoring cached build plugins
2024-05-09T08:23:10.842827Z	Attempting ruby version 2.7.1, read from environment
2024-05-09T08:23:11.942045Z	Using /opt/buildhome/.rvm/gems/ruby-2.7.1
2024-05-09T08:23:12.598528Z	Using PHP version 5.6
2024-05-09T08:23:12.670903Z	5.2.5 is already installed.
2024-05-09T08:23:12.684449Z	Using Swift version 5.2.5
2024-05-09T08:23:12.684991Z	Started restoring cached node modules
2024-05-09T08:23:12.693295Z	Finished restoring cached node modules
2024-05-09T08:23:12.885373Z	Installing NPM modules using NPM version 6.14.15
2024-05-09T08:23:14.773562Z	npm WARN deprecated @types/sass@1.45.0: This is a stub types definition. sass provides its own type definitions, so you do not need this installed.
2024-05-09T08:23:15.450036Z	npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
2024-05-09T08:23:23.902091Z	
2024-05-09T08:23:23.90233Z	> esbuild@0.15.18 postinstall /opt/buildhome/repo/node_modules/esbuild
2024-05-09T08:23:23.902814Z	> node install.js
2024-05-09T08:23:23.902975Z	
2024-05-09T08:23:24.021939Z	
2024-05-09T08:23:24.022133Z	> protobufjs@7.2.6 postinstall /opt/buildhome/repo/node_modules/protobufjs
2024-05-09T08:23:24.022455Z	> node scripts/postinstall
2024-05-09T08:23:24.022545Z	
2024-05-09T08:23:24.093471Z	
2024-05-09T08:23:24.093695Z	> svelte-preprocess@4.10.7 postinstall /opt/buildhome/repo/node_modules/svelte-preprocess
2024-05-09T08:23:24.093839Z	> echo "[svelte-preprocess] Don't forget to install the preprocessors packages that will be used: node-sass/sass, stylus, less, postcss & postcss-load-config, coffeescript, pug, etc..."
2024-05-09T08:23:24.093942Z	
2024-05-09T08:23:24.104425Z	[svelte-preprocess] Don't forget to install the preprocessors packages that will be used: node-sass/sass, stylus, less, postcss & postcss-load-config, coffeescript, pug, etc...
2024-05-09T08:23:24.171853Z	npm notice created a lockfile as package-lock.json. You should commit this file.
2024-05-09T08:23:24.176012Z	npm WARN notsup Unsupported engine for @zip.js/zip.js@2.7.44: wanted: {"deno":">=1.0.0","node":">=16.5.0","bun":">=0.7.0"} (current: {"node":"14.18.0","npm":"6.14.15"})
2024-05-09T08:23:24.176178Z	npm WARN notsup Not compatible with your version of node/npm: @zip.js/zip.js@2.7.44
2024-05-09T08:23:24.180196Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
2024-05-09T08:23:24.180337Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.183949Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/android-arm@0.15.18 (node_modules/esbuild/node_modules/@esbuild/android-arm):
2024-05-09T08:23:24.184114Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/android-arm@0.15.18: wanted {"os":"android","arch":"arm"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.187477Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-android-arm64@0.15.18 (node_modules/esbuild/node_modules/esbuild-android-arm64):
2024-05-09T08:23:24.187625Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-android-arm64@0.15.18: wanted {"os":"android","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.191698Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-darwin-64@0.15.18 (node_modules/esbuild/node_modules/esbuild-darwin-64):
2024-05-09T08:23:24.191808Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-darwin-64@0.15.18: wanted {"os":"darwin","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.196597Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-freebsd-64@0.15.18 (node_modules/esbuild/node_modules/esbuild-freebsd-64):
2024-05-09T08:23:24.19677Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-freebsd-64@0.15.18: wanted {"os":"freebsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.200353Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-darwin-arm64@0.15.18 (node_modules/esbuild/node_modules/esbuild-darwin-arm64):
2024-05-09T08:23:24.200484Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-darwin-arm64@0.15.18: wanted {"os":"darwin","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.2037Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/linux-loong64@0.15.18 (node_modules/esbuild/node_modules/@esbuild/linux-loong64):
2024-05-09T08:23:24.203808Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/linux-loong64@0.15.18: wanted {"os":"linux","arch":"loong64"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.207089Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-android-64@0.15.18 (node_modules/esbuild/node_modules/esbuild-android-64):
2024-05-09T08:23:24.207207Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-android-64@0.15.18: wanted {"os":"android","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.210342Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-linux-32@0.15.18 (node_modules/esbuild/node_modules/esbuild-linux-32):
2024-05-09T08:23:24.210473Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-linux-32@0.15.18: wanted {"os":"linux","arch":"ia32"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.213768Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-freebsd-arm64@0.15.18 (node_modules/esbuild/node_modules/esbuild-freebsd-arm64):
2024-05-09T08:23:24.213872Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-freebsd-arm64@0.15.18: wanted {"os":"freebsd","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.217256Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-linux-arm@0.15.18 (node_modules/esbuild/node_modules/esbuild-linux-arm):
2024-05-09T08:23:24.217388Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-linux-arm@0.15.18: wanted {"os":"linux","arch":"arm"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.222528Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-linux-arm64@0.15.18 (node_modules/esbuild/node_modules/esbuild-linux-arm64):
2024-05-09T08:23:24.222716Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-linux-arm64@0.15.18: wanted {"os":"linux","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.225798Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-linux-mips64le@0.15.18 (node_modules/esbuild/node_modules/esbuild-linux-mips64le):
2024-05-09T08:23:24.225945Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-linux-mips64le@0.15.18: wanted {"os":"linux","arch":"mips64el"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.22894Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-linux-ppc64le@0.15.18 (node_modules/esbuild/node_modules/esbuild-linux-ppc64le):
2024-05-09T08:23:24.229124Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-linux-ppc64le@0.15.18: wanted {"os":"linux","arch":"ppc64"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.232124Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-netbsd-64@0.15.18 (node_modules/esbuild/node_modules/esbuild-netbsd-64):
2024-05-09T08:23:24.232275Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-netbsd-64@0.15.18: wanted {"os":"netbsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.235494Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-openbsd-64@0.15.18 (node_modules/esbuild/node_modules/esbuild-openbsd-64):
2024-05-09T08:23:24.235659Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-openbsd-64@0.15.18: wanted {"os":"openbsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.238767Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-linux-riscv64@0.15.18 (node_modules/esbuild/node_modules/esbuild-linux-riscv64):
2024-05-09T08:23:24.23892Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-linux-riscv64@0.15.18: wanted {"os":"linux","arch":"riscv64"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.242047Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-linux-s390x@0.15.18 (node_modules/esbuild/node_modules/esbuild-linux-s390x):
2024-05-09T08:23:24.24218Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-linux-s390x@0.15.18: wanted {"os":"linux","arch":"s390x"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.246307Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-sunos-64@0.15.18 (node_modules/esbuild/node_modules/esbuild-sunos-64):
2024-05-09T08:23:24.24646Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-sunos-64@0.15.18: wanted {"os":"sunos","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.249517Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-windows-32@0.15.18 (node_modules/esbuild/node_modules/esbuild-windows-32):
2024-05-09T08:23:24.249692Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-windows-32@0.15.18: wanted {"os":"win32","arch":"ia32"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.252725Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-windows-64@0.15.18 (node_modules/esbuild/node_modules/esbuild-windows-64):
2024-05-09T08:23:24.252847Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-windows-64@0.15.18: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.255851Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-windows-arm64@0.15.18 (node_modules/esbuild/node_modules/esbuild-windows-arm64):
2024-05-09T08:23:24.256088Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-windows-arm64@0.15.18: wanted {"os":"win32","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2024-05-09T08:23:24.260192Z	npm WARN metaverse-dao@0.0.0 No repository field.
2024-05-09T08:23:24.264249Z	npm WARN metaverse-dao@0.0.0 No license field.
2024-05-09T08:23:24.264707Z	
2024-05-09T08:23:24.269607Z	added 138 packages from 182 contributors and audited 163 packages in 10.289s
2024-05-09T08:23:24.325973Z	
2024-05-09T08:23:24.326191Z	15 packages are looking for funding
2024-05-09T08:23:24.326286Z	  run `npm fund` for details
2024-05-09T08:23:24.326373Z	
2024-05-09T08:23:24.326442Z	found 0 vulnerabilities
2024-05-09T08:23:24.326501Z	
2024-05-09T08:23:24.349077Z	NPM modules installed
2024-05-09T08:23:24.379405Z	Installing Hugo 0.54.0
2024-05-09T08:23:25.093022Z	Hugo Static Site Generator v0.54.0-B1A82C61A/extended linux/amd64 BuildDate: 2019-02-01T10:04:38Z
2024-05-09T08:23:25.095437Z	Started restoring cached go cache
2024-05-09T08:23:25.104253Z	Finished restoring cached go cache
2024-05-09T08:23:25.166888Z	go version go1.14.4 linux/amd64
2024-05-09T08:23:25.176634Z	go version go1.14.4 linux/amd64
2024-05-09T08:23:25.179007Z	Installing missing commands
2024-05-09T08:23:25.179439Z	Verify run directory
2024-05-09T08:23:25.179674Z	Executing user command: npm run build
2024-05-09T08:23:25.420252Z	
2024-05-09T08:23:25.420482Z	> metaverse-dao@0.0.0 build /opt/buildhome/repo
2024-05-09T08:23:25.42063Z	> vite build
2024-05-09T08:23:25.420746Z	
2024-05-09T08:23:25.818833Z	vite v3.2.10 building for production...
2024-05-09T08:23:25.850816Z	transforming...
2024-05-09T08:23:26.729195Z	8:23:26 AM [vite-plugin-svelte] /src/Dappstore/ListItem.svelte:17:1 A11y: <img> element should have an alt attribute
2024-05-09T08:23:26.729569Z	15: <div class='card' style:background-color={color}>
2024-05-09T08:23:26.729666Z	16:   
2024-05-09T08:23:26.729776Z	17:   <img class="avatar" src="{avatar}">
2024-05-09T08:23:26.729952Z	      ^
2024-05-09T08:23:26.730031Z	18: 
2024-05-09T08:23:26.730086Z	19:   <h2>{title}</h2>
2024-05-09T08:23:26.730152Z	8:23:26 AM [vite-plugin-svelte] /src/Dappstore/ListItem.svelte:25:2 A11y: <img> element should have an alt attribute
2024-05-09T08:23:26.730202Z	23:   
2024-05-09T08:23:26.730246Z	24:     {#if categorypic}
2024-05-09T08:23:26.730312Z	25:     <img width="20px" height="20px" src="{categorypic}">
2024-05-09T08:23:26.730473Z	        ^
2024-05-09T08:23:26.730559Z	26:     {/if}
2024-05-09T08:23:26.730632Z	27:     
2024-05-09T08:23:33.670739Z	Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
2024-05-09T08:23:37.359311Z	✓ 1340 modules transformed.
2024-05-09T08:23:37.36059Z	8:23:37 AM [vite-plugin-svelte] dom compile done.
2024-05-09T08:23:37.360786Z	package      	files	 time	   avg
2024-05-09T08:23:37.360893Z	metaverse-dao	    7	0.25s	35.3ms
2024-05-09T08:23:39.079721Z	rendering chunks...
2024-05-09T08:23:39.103274Z	dist/index.html                  3.27 KiB
2024-05-09T08:23:39.105178Z	dist/assets/index.78082a50.css   27.19 KiB / gzip: 6.04 KiB
2024-05-09T08:23:39.207611Z	dist/assets/index.05112ca5.js    3483.48 KiB / gzip: 916.04 KiB
2024-05-09T08:23:39.207909Z	
2024-05-09T08:23:39.208026Z	(!) Some chunks are larger than 500 KiB after minification. Consider:
2024-05-09T08:23:39.208172Z	- Using dynamic import() to code-split the application
2024-05-09T08:23:39.208363Z	- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/guide/en/#outputmanualchunks
2024-05-09T08:23:39.208454Z	- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
2024-05-09T08:23:39.315113Z	Finished
2024-05-09T08:23:39.315897Z	Note: No functions dir at /functions found. Skipping.
2024-05-09T08:23:39.316017Z	Validating asset output directory
2024-05-09T08:23:40.060541Z	Deploying your site to Cloudflare's global network...
2024-05-09T08:23:42.337412Z	Uploading... (398/399)
2024-05-09T08:23:42.75211Z	Uploading... (399/399)
2024-05-09T08:23:42.752419Z	✨ Success! Uploaded 1 files (398 already uploaded) (1.10 sec)
2024-05-09T08:23:42.752519Z	
2024-05-09T08:23:43.199125Z	✨ Upload complete!
2024-05-09T08:23:45.038401Z	Success: Assets published!
2024-05-09T08:23:46.143701Z	Success: Your site was deployed!

Is it available on a publicly accessible url that you could share so that I could check the console or network tab for errors?

Hi. Thank you for your support. It’s https://cloudatlas.club/

So, looking at the console, you have a “define is not defined” error. Sounds like you’ve got something configured wrong and your bundler isn’t correctly bundling your application

I may have found the solution to my problem and to this one as well: ReferenceError: define is not defined (ver: 1.102.0)

I had the problem starting around version 1.100 as well. There was a change in the static files. But my static files were copied manually month ago, so changes were not taken over after the update to the new version of cesiumjs. Is there any script i could use to copy them at “npm run build”?

Anyway, I created a new repo, copied the static files manually from node to public (fresh files after npm install of 1.117) and made it fill out the entire screen. Clean starter. :wink:

Live: https://metaverse-seed.pages.dev/ (already implemented my basic stuff on top, but the code below, is still untouched inside my code)

Cesium.svelte

<script lang="ts">
	import { onMount } from 'svelte';
	import { Cartesian3, createOsmBuildingsAsync, Ion, Math as CesiumMath, Terrain, Viewer } from 'cesium';
	import '../node_modules/cesium/Build/Cesium/Widgets/widgets.css'

  Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkOWYxN2ViMy00ZmM2LTQzNjMtOGZhZC02NDg2ZmY5MDY4MGMiLCJpZCI6MjE1NzcxLCJpYXQiOjE3MTU4OTUxNTd9.29sj9Ay7XCd14X0Z9s-15mMTqcZX1l-PkVo5NHqCKh8';

	window.CESIUM_BASE_URL = './';

    let viewer: Viewer;
	onMount(async () => {
		viewer = new Viewer('cesiumContainer');
	});
	
</script>

<main id="cesiumContainer">
</main>

<style>
main{
height: 100vh;
width: 100vw;
margin: 0;
padding: 0;
}
</style>

index.html

<!doctype html>
<html lang="en">
  <head>
    <title>Title</title>
    
    <meta charset="UTF-8" />
    <meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0" />
    
    <!-- These meta tags are Apple-specific, and set the web application to run in full-screen mode with a black status bar. Learn more at https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html-->
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-title" content="title" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    
    <link rel="icon" href="/favicon.png" />

</head>
  <body>
    <div id="app" style="margin: 0;padding: 0;"></div>
    <script type="module" src="/src/main.ts"></script>
  </body>
</html>