javascript - Why can't I use my JS revealing module function inside another module? -


i working on project in javascript writing code in separate files using revealing module pattern.

i utilizing gulp concat files 1 app.js file.

the issue having when trying use 1 module within another. please take @ example code below:

my app.js file looks similar this:

const componentone = (function(){ ... return { mymethod: mymethod} })(); const componenttwo = (function(){ ... return { mymethod: mymethod} })(); const componentthree = (function(){ ... return { mymethod: mymethod} })(); 

in individual component files, can call componentone.mymethod() componenttwo , works expected.

however, problem have when want call componentthree.mymethod() within componenttwo. error componentthree undefined. however, when manually modify compiled app.js move componentthree code block above componenttwo, works fine.

i understand why is, , if there way around without using browserify. or browserify (or webpack, requirejs, etc.) solution fix issue this?


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -