Assets path in webpack compiled Cesium

Hello,

I successfully followed this tutorial https://cesiumjs.org/tutorials/cesium-and-webpack/ .

Where we copy the static assets, such as "Assets", webpack puts the Assets into js/mycesium/Assets, which is correct. This is my modification to the tutorial.

CODE FROM webpack.config.js:
CopywebpackPlugin([ { from: path.join(cesiumSource, 'js/mycesium/Assets'), to: 'include/olcs-1.0/Assets' } ]),

However, inside the compiled app.js, the paths to Assets/ is still off the top level root. The browser is throwing 404 not found on all the assets.

I'm doing this because I will have several different apps that will use the same mycesium build (app.js). Assets, Workers, and Widgets will not live on the same level as index.html They will be in <context_root>/js/mycesium/

The question is, how to reflect these paths in the compiled js file?

Thanks in advance for any pointers!

Hi there,

When you define the base path with:

new webpack.DefinePlugin({

// Define relative base path in cesium for loading assets

CESIUM_BASE_URL: JSON.stringify(’’)

})

``

Instead of an empty string, provide the path you would like to use, relative to the Cesium source, at which you are loading you Assets, Workers, and Widgets.

Thanks!

Gabby