Skip to content

Error happened during using yang-js in browser #146

@Verten

Description

@Verten

When I try parse YANG model in browser, it throws error as below:

ERROR TypeError: Cannot assign to read only property 'module' of function 'function evaluate() {
          var _self;

          return (_self = self).eval.apply(_self, arguments);
        }'

here is the YANG model which I was parsed

            const schema = `
                module foo {
                  include foo-sub;

                  container foo {
                    leaf a { type string; }
                    leaf b { type uint8; }
                    list bar {
                      key "b1";
                      leaf b1 { type uint16; }
                      container blob;
                    }
                    uses fs;
                  }
                }`;

              const subSchema = `
                submodule foo-sub {
                  yang-version 1.1;

                  belongs-to foo {
                      prefix "foo";
                  }
                  grouping fs {
                    container fs {
                      leaf c {
                        mandatory true;
                        type string {
                            length "1..max";
                        }
                        description
                          "The alias of effective master key.";
                      }
                    }
                  }
                }`;

              let instance2 = (window as any).Yang.use(
                (window as any).Yang.parse(subSchema, { compile: false })
              );

              instance2 = (window as any).Yang.use(
                (window as any).Yang.parse(schema, { compile: false })
              );
              const compileResult = instance2.compile();

and error throw with this line
image

could anyone help with this? or give some hints? thanks!

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