I've been getting this error:
main.js:1 Uncaught ReferenceError: require is not definedat main.js:1
and this one:
format.html:6 GET http://127.0.0.1:5500/common.js net::ERR_ABORTED 404 (Not Found)
I've downloaded Common JS and have included it in my HTML script.
HTML:
<html lang="en">
<head>
<meta charset="UTF-8">
<script src = "main.js"></script>
<script src="common.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Title</title>
</head>
<body>
<textarea id = "textArea" rows = "50" cols = "80">
</textarea>
<button type = "button">Click me!</button>
</body>
</html>
Javascript:
const http = require('http');
const url = require('url');
const fs = require('fs');
var browserify = require('browserify');
var b = browserify();
b.add('./browser/main.js');
b.bundle().pipe(process.stdout);
How can I fix this? Thanks!