U
U
unsstrennen2020-05-11 01:01:31
npm
unsstrennen, 2020-05-11 01:01:31

How to include packages in source code?

There is a lot of information on the Internet about working with package managers, but it does not answer the main question: how to include these modules in the source code?
Let's say I downloaded the package using npm/yarn, I'm NOT using node.js and I want to include the module in some HTML page. How can i do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kovalsky, 2020-05-11
@unsstrennen

You download the module using npm, it gets into node_modules, from there you drag it in one of two ways: if the module is implemented as a regular script, then create a script element and specify the address of the script in the src attribute; if the module is implemented in one of the generally accepted formats, then load it in the appropriate format, there is an article on MDN
about this. You can also use browserify . Its essence is precisely that you will write code for the browser, and browserify modifies it in such a way that it really works) That is, it will load the modules itself, for example

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question