use Requirejs or a similar tool to build a single-file JS code by linking a module made of multiple JS files

I wrote a code [url removed, login to view] that loads and uses a third party module:

const foo = require('foo');


var x = [url removed, login to view](data);

I installed the module foo with npm install. I can run [url removed, login to view] from terminal and it works. Now I want to build a single JS file that I could use in a browser. The problem is that the module foo is not just a code named [url removed, login to view], but a folder ./node_modules/foo/dist/ with 3 JS files in it: [url removed, login to view], [url removed, login to view], c.js.

I used Requirejs and I managed to build a sample bundle out of [url removed, login to view] and some other module bar but only when it consists of a single file bar.js. When I'm trying to do the same with foo, I'm getting the error

Tracing dependencies for: main

Error: ENOENT: no such file or directory, open '/home/greg/blabla/node_modules/[url removed, login to view]'

Indeed foo is not a file but a directory that contains the code files. How do I get around this issue and load a module made of multiple JS scrips by referring to the module name and not to the individual JS file name(s)? Please bid if you know how. This should be a 5-10 min job for an expert.

I also tried Browserify. It creates a single bundle JS file without complaints and I can see that this file actually includes the codes from all 3 of the module's JS files, but the bundled JS code fails to work in a browser because it still contains a require() call in it...

Навыки: JavaScript, Linux, Mobile App Development, Node.js

Показать больше: require js function, requirejs wiki, requirejs almond, is requirejs dead, require js example, requirejs vs webpack, almond js cdn, requirejs alternatives, reverse engineering exe file code, want can build exe file, embed flv file code generator, php single page code, data multiple excel file single file, build exe source code, word count text file code, mystoremaps similar tool, use web address link opening text file vba, php single file simple file manager, use google adwords tool api, build hlp file

О работодателе:
( 16 отзыв(-а, -ов) ) Champaign, United States

ID проекта: #16367004



hi. send me files and instructions how to reproduce the error. i will try to solve it .

$30 USD за 1 день
(9 отзывов(-а))

2 фрилансеров(-а) готовы выполнить эту работу в среднем за $30


Hello, I would love to work with you. I m a professional web developer and designer. I have good knowledge of javascript and function. I would be a great help to you. more details I can explain in chat. looking for Больше

$30 USD за 1 день
(0 отзывов(-а))