cesium-navigation
cesium-navigation copied to clipboard
Loading with Webpack+Cesium
I love this plugin. I have been using the standalone version with Cesium in a desktop application and it works great. I'm currently developing a web app which is built using Webpack (including Cesium). I can't quite figure out how to integrate this plugin or if it is possible.
Has anyone successfully loaded with Webpack?
I think an npm package will solve the issue of loading with Webpack. The plugin needs to get converted into a npm package. I have no time to work on it. I'm looking for a volunteer to implement the package.
Thanks,
Alberto
It is not very hard.
- npm install necessary modules: hammerjs, markdown-it, markdown-it-sanitizer, leaflet
- replace all cesium modules in define() to a single reference to cesium, and use variables to refer to these modules. (assume you can import cesium anywhere in the project)
- replace hammer to hammerjs in define()
- replace knockout-es5 to cesium/thirdparty/knockout-3.4.2.js in define() (I dont know Why knockout-es5 shipped with cesium lack so many features.)
- delete less file in define()
- use an index.js to import the viewercesiumnavigationmixin.js and require the styles/cesium-navigation.less file, and export default viewercesiumnavigationmixin.
- import the index.js (import the containing dir directly)
All we have to do is to figure out the module stuff, no need to change the code inside.
BTW, I compile the whole source tree of cesium in my project. If you import the dist of cesium, it may be different.