CesiumGS / cesium-webpack-example

The minimal recommended setup for an application using Cesium with Webpack.
Apache License 2.0
248 stars 160 forks source link

treeshake example #34

Closed chris-cooper closed 2 years ago

chris-cooper commented 2 years ago

It would be good to include an example of best practice for more production oriented builds, like removing debug pragmas and tree shaking etc.

e.g. in this toy example the build size is reduced 16.4 MiB => 78.5 KiB with Cesium 1.96.

Note that sideEffects: false can alternatively live in the Cesium package.json. It can include a list of files if some do have side effects that need to be respected https://webpack.js.org/guides/tree-shaking/

ggetz commented 2 years ago

Hi @chris-cooper, I added the recommended config after a change in CesiumJS which allows tree shaking in https://github.com/CesiumGS/cesium-webpack-example/pull/35. Our README also describes how to remove debug pragmas. OK to close this?