'Failed to resolve module specifier "net"
I am running express app.
I have a connect.js file I have a class in which I have some functions running some tcp/ip socket code.
And from html file, I am calling the connect.js file.
This connect.js file imports 'net' module.
Running index.js has no issues but the browser the browser throws
I get an error in the browser.
Failed to resolve module specifier "net". Relative references must start with either "/", "./", or "../".
below are the snippets from my code.
/connect.js
import net from 'net'
class Connect{
constructor(Ip, Port) {
this.Host = Ip;
this.Port = Port;
}
index.js
app.get('/', function(req, res){
res.render('main.html');
main.html
<head>
<title>Login</title>
<script type = "module" src= '../labconnect.js'></script>
</head>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
