Of course I can add a little bit more code. I might set up a complete fresh vue-cli project this weekend. I am currently working in my app and I believe it is an issue with the initial import with webpack in combination with tree-shacking.
I am using the vue-cli with vuex & vue-router.
(1) Import Cesium in main.js // store.js
import Cesium from 'cesium/Cesium'
import widget from 'cesium/Widgets/widgets.css' //eslint-disable-line
(2) initializing the viewer
The cesium-div is within a vue-component
a vuex action is call on creation of the vue component:
CesiumViewer.vue
created() {
this.$store.dispatch("aCsInit").then(() => {...
});
},
store.js
aCsInit({ commit }) {
commit('mInteractionReset');
return new Promise((resolve, reject) => {
setTimeout(() => {
commit('mCsInit')
resolve()
}, 10)
})
},
mCsInit(state) {
let viewerData = { //eslint-disable-line
...
...
imageryProvider: Cesium.createTileMapServiceImageryProvider({
url: Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII')
}),
};
let viewer = new Cesium.Viewer('cesiumContainer', viewerData);
...
}
Thats more or less it. The rest can be done using the viewer object and Cesium.XYZ calls within actions/mutation in the vue app.
After using the
import { Color } from 'cesium/Cesium'
and renaming.
now Cesium.createTileMapServiceImageryProvider (...)
causing an error.
As I mentioned before I don't have much knowledge about JavaScript build process.
I don't really understand jet why I sometimes get the modules behind Cesium. and when not. (See screenshot)
I will check potential cesium-vue integration this weekend. As mentioned before I did not look into some for a few month. But in case anyone has a good working solution I clad for the help :)
I will provide an update how i solved this.
Thanks.