Adding new scripts and other stuff on local development

recently i continued to developing my game on local-side because of cors issues with socket.io but i faced with few difficulties
the most important one is adding new script

the only idea i have adding new folder with random name made with numbers and add it to every file that must include it

is there are more easy way?

CORS shouldn’t be an issue if the server is setup to allow for it. Is it a local hosted server you are trying to connect to or one on a server else where? If the issue is https trying to connect to http, maybe use ngrok to create a https endpoint? https://ngrok.com/

The scripts can go anywhere. config.json maps the assets to the files. If you pretty print/format the JSON, you can see how a script is setup:

"46499668": {
            "tags": [],
            "name": "changeSpriteFromCode.js",
            "revision": 1,
            "preload": true,
            "meta": null,
            "data": {
                "scripts": {
                    "changeSpriteFromCode": {
                        "attributesOrder": ["framesTextures"],
                        "attributes": {
                            "framesTextures": {
                                "type": "asset",
                                "assetType": "sprite",
                                "array": true
                            }
                        }
                    }
                },
                "loading": false,
                "loadingType": 0
            },
            "type": "script",
            "file": {
                "filename": "__game-scripts.js",
                "size": 1684,
                "hash": "1ee85cd2e85b183ca832d7eae4ea5b33",
                "url": "__game-scripts.js"
            },
            "region": "eu-west-1",
            "i18n": {},
            "id": "46499668"
        },

You can see the URL for the file in the file object and that is a relative path to the source file.

Just ensure you give it an unique ID.

thanks, i realized how to do that myself with some tests,
in config.json i made this configuration


for binding script into element, i needed to configure like below image in main json file that named with game id(i guess)

folder structure:
Ekran Resmi 2021-06-14 02.40.46

1 Like