cesium-navigation icon indicating copy to clipboard operation
cesium-navigation copied to clipboard

Loading with Webpack+Cesium

Open AwkEng opened this issue 7 years ago • 2 comments

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?

AwkEng avatar Nov 17 '17 09:11 AwkEng

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

alberto-acevedo avatar Jan 11 '18 18:01 alberto-acevedo

It is not very hard.

  1. npm install necessary modules: hammerjs, markdown-it, markdown-it-sanitizer, leaflet
  2. 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)
  3. replace hammer to hammerjs in define()
  4. 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.)
  5. delete less file in define()
  6. use an index.js to import the viewercesiumnavigationmixin.js and require the styles/cesium-navigation.less file, and export default viewercesiumnavigationmixin.
  7. 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.

pkuwwt avatar May 02 '18 06:05 pkuwwt