M
M
Messi2017-04-07 22:01:59
JavaScript
Messi, 2017-04-07 22:01:59

Connecting files installed via npm?

Question about working with npm :

  1. Created a project folder.
  2. Created package.json and registered the required package.
  3. I did npm install in the project folder
  4. The node_modules folder was created /
  5. It contains a folder with the required package.
  6. How now to correctly connect the js file from the package to the index.html file?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kitmanov, 2017-04-08
@FitTech

Well, in its simplest form

<script src="./node_modules/package/index.js"></script>
- if you are very, very lucky , but they usually use some kind of assembler / loader - webpack , systemjs, rollup, browserify. Because in such a “simplest version” there are so many pitfalls that you cannot rake them manually.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question