I
I
Ivan2019-08-02 11:50:09
JavaScript
Ivan, 2019-08-02 11:50:09

Module request from node_modules?

I want to connect the progress bar module, downloaded via npm to node_modules. After that, he pointed to and wrote a small script in his script, but the browser replied that he could not find the desired variable that was specified in the module. Found out on the forumsvar ProgressBar = require('progressbar.js')

This is because require() doesn't exist in JavaScript on the browser/client side.
I decided to try just cloning the module to my folder and just register it in , but in this case, my script does not understand at all what I want from it. How can I use the module? <head>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Arushanov, 2019-08-02
@BenderIsGreat34

Perhaps this is not the same module, but in a different one...
https://progressbarjs.readthedocs.io/en/latest/
// If you aren't using any module loader, progressbar.js exposes
// global variable: window.ProgressBar
var line = new ProgressBar.Line('#container');

S
Serezha, 2019-08-02
Ahen @Ahen

Look in the documentation of the module to see if it can be connected in the browser, search for cdn.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question