Skip to content
This repository was archived by the owner on Oct 9, 2020. It is now read-only.
This repository was archived by the owner on Oct 9, 2020. It is now read-only.

Support building anonymous + named define AMD modules #337

Closed
@finom

Description

@finom

After I've built the project via buildStatic I've got an error in JS file:

Uncaught Module 2 not present.

What I am trying to do is to include to the project a source of MatreshkaJS framework. Config:

map: {
        matreshka_dir: 'lib/matreshka',
        matreshka: 'lib/matreshka/matreshka',
        balalaika: 'lib/matreshka/matreshka',
        xclass: 'lib/matreshka/matreshka',
}

File lib/matreshka/matreshka contains definitions of named modules:

define('matreshka', [
    'matreshka_dir/matreshka.class',
    'matreshka_dir/matreshka-object.class',
    'matreshka_dir/matreshka-array.class'
], function(MK, MK_Object, MK_Array, MK_binders) {
    return MK;
});

define('balalaika', ['matreshka_dir/core/dom-lib/balalaika-extended'], function($b) {
    return $b;
});

define('xclass', ['matreshka_dir/xclass'], function(Class) {
    return Class;
});

There isnot anonymous module definition. After all I can import named modules by the app:

import MK from 'matreshka';
import $ from 'balalaika';

It works great in development. But after compile I'm getting the error described above. The module 'lib/matreshka/matreshka isn't presented in resulting file.

I tried to modify lib/matreshka/matreshka by adding anonymous definition:

define(['matreshka'], function(MK) {
    return MK;
});

And this module appeared in compiled JS but I've got almost the same error:

Uncaught Module matreshka_dir/matreshka.class not present.

This logic worked fine with RequireJS builder.

I hope somebody looks at the issues.

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