Remote bundles aren't working in Simulator

I am using Remote Bundles in my project. When I build for Web and Android, everything works fine, as well as the Preview in the browser or editor, but not in the Simulator.

Steps to reproduce:

  • Set up the remote bundle in the assets.
  • Write code to load it by name or URL in the game startup, for example in the onLoad method.
  • Launch the preview in the Simulator.

My bundle contains a TypeScript module, a component that calls a function from that module, and a prefab containing that component:

script-bundle:
|-- external.ts // Just some code
|-- ExternalScriptExecutor.ts // Component importing and calling code from the previous script
|-- ExternalScriptNode.prefab // The only Node containing the previous component

The folder with the built bundle is uploaded to the server. The server address is set in the build settings for Web and Android.

In the Simulator, when attempting to load the bundle by name (asssetManager.loadBundle('script-bundle', ...)), the following error is seen in the console:

Read file failed: path: remote/script-bundle/cc.config.json 
Error: Read file failed: path: remote/script-bundle/cc.config.json
    at Object.readFile (jsb-adapter/engine-adapter.js:1651:13)
    at readJson (jsb-adapter/engine-adapter.js:1681:13)
    at parseJson (jsb-adapter/engine-adapter.js:2178:3)
    at download (jsb-adapter/engine-adapter.js:2060:5)
    at downloadJson (jsb-adapter/engine-adapter.js:2190:3)
    at downloadBundle (jsb-adapter/engine-adapter.js:2210:3)
    at process (src/cocos-js/builtin-res-mgr.jsb-3d62fcda.js:9786:21)
    at retry (src/cocos-js/builtin-res-mgr.jsb-3d62fcda.js:9133:15)
    at Downloader.download (src/cocos-js/builtin-res-mgr.jsb-3d62fcda.js:9813:17)
    at PackManager.load (src/cocos-js/builtin-res-mgr.jsb-3d62fcda.js:10094:32)

It seems that an address of a remote server should be provided before “remote”, but I didn’t find the way to set this address for the Simulator.

If the Simulator is supposed to use the local version of the bundle, then it is unclear why it is trying to access the remote version.

If I try to load the bundle through a direct link:

assetManager.loadBundle('https://my.server.com/remote/script-bundle', ...)

Then Cocos Creator can find the path, but the following error occurs:

src/cocos-js/index-75f3dee5.js:653
A Class already exists with the same __cid__ : "89b9an+fipPL5U75Tb+rc0E".

This sounds like the class that is inside the bundle also exists locally, and when the bundle is loaded, it gets re-registered.