patorjk / Extendible-BBCode-Parser

Allows you to parse BBCode and to extend the markup to add your own tags. All major tags are supported and parser reports back any errors it finds.
http://patorjk.com/bbcode-previewer/
MIT License
133 stars 54 forks source link

Problem using node build in browser #18

Closed ng-dan closed 7 years ago

ng-dan commented 7 years ago

Hi,

I'm including a version of this project in my code after doing an npm install, and I'm getting the following error: Uncaught ReferenceError: module is not defined at xbbcode.js:797

The code block in question is:

// for node
if (module) {
    module.exports = XBBCODE;
}

I presume this is because I'm not using this as part of a node project.

Any help on this matter would be greatly appreciated, thanks!

patorjk commented 7 years ago

What web browser are you using? If you're not using node you can just delete those 3 lines, however, that shouldn't give you any errors. If you change it to this do you still get an error?

if (typeof module !== "undefined") {
    module.exports = XBBCODE;
}
ng-dan commented 7 years ago

I'm using the latest version of Google Chrome. I could delete those lines however this is part of an automated build process and this would add unnecessary complexity to it.

Changing it to that works.

patorjk commented 7 years ago

Thanks for the info. I've gone ahead and updated the repo, however, I'm not on a computer where I can push to npm so I'll do that tonight.

ng-dan commented 7 years ago

Awesome, thanks for your help.