Updated (20201027) I found a check of layer by
layer.constructor.name === "SingleTileImageryProvider"
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:
Put layers into viewModel
const add_gbloverlay = (url, name, alpha, show, rectangle) => {
const lay = new SingleTileImageryProvider({
...
});
Other codes are modified based on cesium sandcastle example: https://sandcastle.cesium.com/?src=Imagery%20Layers%20Manipulation.html
Any comments would be appreciated. Thanks a lot.
(Note: because I have aother problem for large bundle size on this forum Large bundle size
so I still output webpack-bundle-analyzer result in running. Please just skip it here.