Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use tmxData.type instead of file extension and also return a result for xml extension #1228

Merged
merged 2 commits into from
May 16, 2024

Conversation

customautosys
Copy link
Contributor

Dear Olivier,

I would like to suggest this change as for those of us using a build step (React / Vue), "tsx" is usually recognised as a typescript-jsx file type which renders us unable to import an asset with that extension as it would be parsed wrongly. Therefore, I suggest to use the type attribute instead of the file extension if available. Also, if the type is XML, it should allow the user to deal with whatever was parsed rather than simply returning nothing.

I would like to suggest this change as for those of us using a build step (React / Vue), "tsx" is usually recognised as a typescript-jsx file type which renders us unable to import an asset with that extension as it would be parsed wrongly. Therefore, I suggest to use the type attribute instead of the file extension if available. Also, if the type is XML, it should allow the user to deal with whatever was parsed rather than simply returning nothing.
@obiot
Copy link
Member

obiot commented May 16, 2024

it could even be simplified to result = data.map || data.tilesets[0];.

after all tsx files only defines tileset, so if map is defined its a tmx file, and if not it's automatically a tsx file.

@customautosys
Copy link
Contributor Author

customautosys commented May 16, 2024

I just pushed a new commit customautosys@95eb9b7 but it's not appearing yet, I did result = data.map || data.tilesets[0] || data; so in case for some reason there is no "map" or "tilesets" it'll still return something.

@obiot obiot merged commit 276199e into melonjs:master May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants