Skip to content

How to access a javscript library whose name includes '-'? #903

Open

Description

@warrenchopin

Hi,

I am trying to integrate a Javascript library whose name is 'babylon-htmlmesh'. As you can see, the name of the library includes '-' character. I found that Transcrypt mistranslated it adding a space character to both sides of '-' character.

python .py file:

api = __pragma__('js',
    '{}',
    'babylon-htmlmesh;'
)

Transcrypted .js file:

export var api = babylon - htmlmesh;

Note that '-' became ' - ' after Transcrypted above.
Because of the added spaces, Javascript raises an error.

How can I access a javscript library whose name includes '-' in Transcrypt?

Thanks in advance.

Activity

  1. changed the title [-]How to access a javscript library who name includes '-'?[/-] [+]How to access a javscript library whose name includes '-'?[/+] on Jul 24, 2025
  2. warrenchopin commented on Jul 24, 2025

    @warrenchopin
    Author

    I found a way:

    api = __pragma__('js',
        '{}',
        #'babylon-htmlmesh;' # CAUTION: '-' is Transcrypted to ' - ' raising an error in Javacript
        'window["babylon-htmlmesh"];'
    )
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions