Strangely my code work in development, but got this error in production after yarn build
I tried a knockout function to select some url of image source as SingleTileImageryProvider, such as this example in sandcastle:
In this example, user select one of the basemaps, and I modified it to select raster images by
then push these layers into an array of viewModel as a select input. It works well in development (npm run dev in a react app). No related errors and No warnings. Function as expected. After build, it also work to show the default image source, but when I try to select different image to show (as following figure), got this error and rendering stopped:
“An error occurred while rendering. Rendering has stopped.
TypeError: t[i].queueReprojectionCommands is not a function”
Tracking each code step in dev source map, it seems everything is fine. Google shows nothing about this error. Could anyone give me some comments or some possible ways to handle this error? Thanks.
(Function works when in dev, but stops rendering in prod when select another image)
would fail after build (but ok in dev). So I mark and modify it, then everything work well both in dev and prod. So this problem got solved.
I modify a smaller reproducible repo (on preactjs) for this problem:
The reproducible repo is https://github.com/cywhale/preact_cesium
Just clone it and npm install
develpment version is work well: (npm run dev)
After build (npm run build) and npm run serve, got the error as my problem.
The code about layer selection in a modal (icon in left-top corner on screen) is here: