I can't import npm module using for example import fs from 'fs';
in my main.js file that linked with index.html.
Script tag that connect JS file has attribute type="module"
.
Error in console of browser throws error: Uncaught TypeError: Failed to resolve module specifier "fs". Relative references must start with either "/", "./", or "../".
.
BUT npm modules must be connected by pointing only module name, without path and I already did that in another project and it worked correctly.
Then I tried to point relative path to fs module. But node_modules doesn't have folder 'fs'. Instead it contains several folders with 'fs' in start of each folder name.
At that moment I was completely confused :(