Skip to content
This repository was archived by the owner on Apr 11, 2026. It is now read-only.
This repository was archived by the owner on Apr 11, 2026. It is now read-only.

Не работает импорт экстеншнов #6

Description

@nook-ru

Возникает ошибка Uncaught TypeError: xxx is not a constructor/function

Воспроизвести можно так:

  1. Создаем пару экстеншенов:

    $ mkdir -p ./local/js/partner/module && cd $_
    
    $ bitrix create ext1
    
    $ bitrix create ext2
  2. Добавляем в ext2 импорт ext1:

    --- a/local/js/partner/module/ext2/src/ext2.js
    +++ b/local/js/partner/module/ext2/src/ext2.js
    @@ -1,10 +1,13 @@
     import {Type} from 'main.core';
    +import {Ext1} from "partner.module.ext1";
     
     export class Ext2
     {
            constructor(options = {name: 'Ext2'})
            {
                    this.name = options.name;
    +
    +               this.ext1 = new Ext1();
            }
     
            setName(name)
  3. $ bitrix build -p .

  4. Подключаем:

    <?php
    
    \Bitrix\Main\UI\Extension::load(['partner.module.ext2']);
    ?>
    <script>
    var ext2 = new BX.Partner.Module.Ext2();
    </script>

Видим ошибку:

image

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