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

Uncaught ReferenceError: module is not defined #4

Open
Protocol-X opened this issue May 29, 2022 · 5 comments
Open

Uncaught ReferenceError: module is not defined #4

Protocol-X opened this issue May 29, 2022 · 5 comments

Comments

@Protocol-X
Copy link

Protocol-X commented May 29, 2022

I receive this error using the standalone and standalone min version. The library works for BOB but it throws exceptions anytime do is used.

it appears you are assigning a key to module which doesnt exist nor does modules.
Most of your code is using modules. If you add the var modules={} and change it from module.xxx to modules.xxx the code works as expected.

I know this isn't a correct fix, but I'm node a node developer. Thes is just what worked for me.

+ var modules = {}; //add to standalone and standalone.min

- module.exports = BOB;
+modules.exports = BOB;

ERROR TypeError: BOBChildArray is not a constructor
    at y.d (scripts.js:1:16481)
    at y.do (scripts.js:1:16464)
    at main.js:1:723928
    at Array.forEach (<anonymous>)
    at cX (main.js:1:723862)
    at t.markupBuilder (main.js:1:724056)
    at Object.next (main.js:1:723519)
    at F.next (main.js:1:3509)
    at W._next (main.js:1:3191)
    at W.next (main.js:1:2883)

The errored sections is as follows:

module.exports=BOB,BOBChildArray=class{constructor(l,h){this.dataset=l,this.parent=h,this.bobs=[]}content(l){return this.co(l)}co(l){var h,a,n;for(h=a=0,n=this.dataset.length;0<=n?a<n:a>n;h=0<=n?++a:--a)BOB._data=this.dataset[h],this.bobs[h]&&this.bobs[h].co(l);return this}style(l){return this.st(l)}st(l){var h,a,n;for(h=a=0,n=this.dataset.length;0<=n?a<n:a>n;h=0<=n?++a:--a)BOB._data=this.dataset[h],this.bobs[h]&&this.bobs[h].st(l);return this}class(l){return this.cl(l)}cl(l){var h,a,n;for(h=a=0,n=this.dataset.length;0<=n?a<n:a>n;h=0<=n?++a:--a)BOB._data=this.dataset[h],this.bobs[h]&&this.bobs[h].cl(l);return this}id(l){var h,a,n;for(h=a=0,n=this.dataset.length;0<=n?a<n:a>n;h=0<=n?++a:--a)BOB._data=this.dataset[h],this.bobs[h]&&this.bobs[h].id(l);return this}insert(l,h){return this.i(l,h)}i(l,h){var a,n,s;for(a=n=0,s=this.dataset.length;0<=s?n<s:n>s;a=0<=s?++n:--n)BOB._data=this.dataset[a],this.bobs[a]?this.bobs[a]=this.bobs[a].insert(l,h):this.bobs.push(this.parent.insert(l,h));return this}append(l,h){return this.a(l,h)}a(l,h){var a,n,s;for(a=n=0,s=this.dataset.length;0<=s?n<s:n>s;a=0<=s?++n:--n)BOB._data=this.dataset[a],this.bobs[a]?this.bobs[a]=this.bobs[a].a(l,h):this.bobs.push(this.parent.a(l,h));return this}prepend(l,h){return this.p(l,h)}p(l,h){var a,n,s;for(a=n=0,s=this.dataset.length;0<=s?n<s:n>s;a=0<=s?++n:--n)BOB._data=this.dataset[a],this.bobs[a]?this.bobs[a]=this.bobs[a].p(l,h):this.bobs.push(this.parent.p(l,h));return this}prettyPrint(){return this.pp()}pp(){return this.s(!0)}toString(){return this.s()}s(l=!1){var h,a,n,s,r;if(this.parent)return this.parent.s(l);for(a="",n=0,s=(r=this.bobs).length;n<s;n++)(h=r[n]).parent=!1,a+=h.s(l);return a}do(l){return this.d(l)}d(l){var a,n;for(a=0,n=this.bobs.length;a<n;a++)BOB._data=this.dataset[i],this.bobs[i]?this.bobs[i]=this.bobs[i].d(l):this.bobs.push(this.parent.d(l));return this}up(){return this.u()}u(){var l,h,a;if(!this.bobs[0])return BOB._data=null,this.parent;for(l=h=0,a=this.bobs.length;0<=a?h<a:h>a;l=0<=a?++h:--h)this.bobs[l]=this.bobs[l].u();return this.bobs[0]===this.parent?(BOB._data=null,this.parent):this}},BOB=require("./BOB.standalone"),console.log(new BOB("div").toString());

@stephan-nordnes-eriksen
Copy link
Owner

Ohh.. I will investigate this. Thanks for reporting!

Unfortunately I have a bit of a random response time these days, but I will try to get to this as soon as possible.

@stephan-nordnes-eriksen
Copy link
Owner

Could you provide a minimal, reproducible example? Makes it easier for me to help out :)

@Protocol-X
Copy link
Author

Sure,
Sorry about that. It can be replicated using any of your examples that use do(), in angular 13.

new BOB("ul").do([1,2,3]).insert("li").content(BOB.data).s() //=> <ul><li>1</li><li>2</li><li>3</li></ul>

@Protocol-X
Copy link
Author

Ohh.. I will investigate this. Thanks for reporting!

Unfortunately I have a bit of a random response time these days, but I will try to get to this as soon as possible.

No worries. Your library is great. It is almost an equal replacement to Groovy's markupbuilder. And saved me a ton of time having to write templates and services.

@stephan-nordnes-eriksen
Copy link
Owner

That's great to hear. I recently had a child, so I have been busy with that. Hopefully I can get to fixing this soon. Lovely to hear that someone other than me get some use out of this lib!

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

No branches or pull requests

2 participants