I came across several JavaScript projects and libraries that use this require () function to include other files, for example:
require('somefile')
I have never heard of this, and apparently this is something like node.js, which I do not have and do not use.
I just intend to use these JavaScript libraries on my own sites, but I see all kinds of instructions involving "npm" (whatever that is). Then there is supposedly a replacement for required.js , but it seems that a different syntax is used, for example, the forced use of require ([...]) or something, while the projects I need to include just require (...).
What is the easiest way to handle this, do you need (...) material when using JavaScript projects on regular html5 websites? (i.e. everyone should work on the client side)
Addition: I already tried require.js, but it does not work. For example, the first line in somelibrary.js is this:
var assert = require('assert')
when I previously included require.js and then somelibrary.js, I get this error:
Unhandled exception: Error: module name "assert" not loaded but for context: _. Use require ([])
And this happens in everything that requires () contains
Another addition: I noticed that people mention the "browser". And some of the js projects that I'm trying to include also recommend this. Apparently, this should create one ready-to-use .js file that I can include. But
.js ? , ? - -, ?
, , -, node.js, , , node.js( "npm -g install browserify" ..)
/li >