When it comes to utilizing npm-installed modules with requirejs
, a common question arises: how do I actually use requirejs
if it's installed via npm install requirejs
in the first place?
I've gone through examples of using requirejs
provided in the example-section. These examples generally assume that require.js
is downloaded and placed in a specific location as stated in the documentation:
do not do something like require("./node_modules/foo/foo").
So, is it incorrect to include the following code in an index.html
file?
<html>
<head>
<script data-main="scripts" src="node_modules/requirejs/require.js"></script>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
If requirejs
is npm-installed, what is the recommended approach for its usage? Any guidance or corrections on any missed documentation points would be greatly appreciated. Thank you.