# Using Submodules in sandcastle

**URL:** <https://community.cesium.com/t/using-submodules-in-sandcastle/41904>\
**Category:** CesiumJS\
**Created:** [July 7, 2025, 8:41am UTC](https://community.cesium.com/t/using-submodules-in-sandcastle/41904 "2025-07-07T08:41:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xuncanzhe1](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/xuncanzhe1/32/28173_2.png) [@xuncanzhe1](https://community.cesium.com/u/xuncanzhe1)\
**Post date:** [July 7, 2025, 8:41am UTC](https://community.cesium.com/t/using-submodules-in-sandcastle/41904/1 "2025-07-07T08:41:43Z")

</div>

hello, everyone. I just recently picked up Cesium again, and I noticed that the code structure has been significantly updated. The full switch to ESM looks very good. However, I have some problems using sandcastle. I need to access Cesium core submodules in sandcastle instead of compiled Cesium.js. Is there any best practice or article blog about sandcastle?

---

<div class="post-metadata">

**Author:** ![jjspace](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/jjspace/32/4102_2.png) [@jjspace](https://community.cesium.com/u/jjspace)\
**Post date:** [July 7, 2025, 9:35pm UTC](https://community.cesium.com/t/using-submodules-in-sandcastle/41904/2 "2025-07-07T21:35:01Z")

</div>

Hey @xuncanzhe1, thanks for the question!

It just so happens that we are currently rebuilding and upgrading Sandcastle! One of the changes is to treat the JS code in a sandcastle as a `type="module"` script so import statements work, both from CesiumJS and external scripts. Feel free to read more or leave feedback in this thread: [Upgrading Sandcastle: We Need Your Input!](https://community.cesium.com/t/upgrading-sandcastle-we-need-your-input/39715)

That said, you should have full access to everything Cesium exports in the global `Cesium` object in Sandcastle. Can you share more about what you’re not able to access? Or explain more what specific problems you’re running into using Sandcastle?

---

<div class="post-metadata">

**Author:** ![xuncanzhe1](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/xuncanzhe1/32/28173_2.png) [@xuncanzhe1](https://community.cesium.com/u/xuncanzhe1)\
**Post date:** [July 8, 2025, 1:18am UTC](https://community.cesium.com/t/using-submodules-in-sandcastle/41904/3 "2025-07-08T01:18:43Z")

</div>

> [@jjspace](#):
>
> It just so happens that we are currently rebuilding and upgrading Sandcastle! One of the changes is to treat the JS code in a sandcastle as a `type="module"` script so import statements work, both from CesiumJS and external scripts. Feel free to read more or leave feedback in this thread: [Upgrading Sandcastle: We Need Your Input!](https://community.cesium.com/t/upgrading-sandcastle-we-need-your-input/39715)
> 
> That said, you should have full access to everything Cesium exports in the global `Cesium` object in Sandcastle. Can you share more about what you’re not able to access? Or explain more what specific problems you’re running into using Sandcastle?

Hello, Thanks for your reply and information. I noticed that sandcastle uses Build/CesiumUnminified/index.js, a compiled ESM mode file. But I want to use Source/Cesium.js so that I can view it directly after updating the module code and refreshing the browser. I changed the reference path to Source/Cesium.js, but the browser prompts that this method cannot be used directly: export { Buffer } from ‘@cesium/engine’;

---

<div class="post-metadata">

**Author:** ![jjspace](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/jjspace/32/4102_2.png) [@jjspace](https://community.cesium.com/u/jjspace)\
**Post date:** [July 8, 2025, 2:05pm UTC](https://community.cesium.com/t/using-submodules-in-sandcastle/41904/4 "2025-07-08T14:05:59Z")

</div>

You are correct, currently sandcastle is set up to use the full, bundled ESM module for the `cesium` package. It’s not set up to use the workspace packages like `@cesium/engine` directly. This is something we may be able to consider for the new version of Sandcastle but it’s unlikely to change in the current version.

It sounds like you’re trying to use Sandcastle to test some changes to CesiumJS itself locally. If that’s the case the local development server, started with `npm start`, will automatically rebuild the `index.js` file after you make changes and refresh. This should let you see any updates take effect immediately.

---

<div class="post-metadata">

**Author:** ![xuncanzhe1](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/xuncanzhe1/32/28173_2.png) [@xuncanzhe1](https://community.cesium.com/u/xuncanzhe1)\
**Post date:** [July 10, 2025, 7:46am UTC](https://community.cesium.com/t/using-submodules-in-sandcastle/41904/5 "2025-07-10T07:46:51Z")

</div>

Got it, thanks for the information.
