'how to import script file in HTML in node.js project

I'm new member in this field & this is my first question on stackoverflow..

I trying to make QR code scanner web application on Node.js, and I using "qr-scanner" dependency for this.

but when I run this application an error comes in console "Failed to load resource: the server responded with a status of 404 (Not Found)"

because Failed to load file, so I edit the path in HTML file in script section but still I am facing same issue..

So I am requesting to you please give me suggestion for correction..

thanks..



Solution 1:[1]

Basically you have 2 methods:

import (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import)

import defaultExport from "module-name";
import { export1 } from "module-name";

require (https://www.w3schools.com/nodejs/nodejs_modules.asp)

var http = require('http');

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Xin