I'm trying to use discordjs in the js file linked to the homepage of my website.
I've first referred to the library in the head section, like this:
<script src="lib/discord.js/"></script>
But here I get the error "(index):1 Uncaught SyntaxError: Unexpected token '<' " as Chrome seems to be trying to use an html file which indicates what's in the lib/discord.js/ directory.
I tried to add the type="typescript" info into the tag but then I can't use the library anymore.
So I installed browserify to require library in a nodejs style, but once again got an error trying to create the bundle.js:
Error: Parsing file /Users/polochon/Desktop/node_modules/discord.js/src/managers/ApplicationCommandPermissionsManager.js: Unexpected token (384:18)
at Deps.parseDeps (/usr/local/lib/node_modules/browserify/node_modules/module-deps/index.js:519:15)
at getDeps (/usr/local/lib/node_modules/browserify/node_modules/module-deps/index.js:447:44)
at /usr/local/lib/node_modules/browserify/node_modules/module-deps/index.js:430:38
at ConcatStream.<anonymous> (/usr/local/lib/node_modules/browserify/node_modules/concat-stream/index.js:37:43)
at ConcatStream.emit (node:events:406:35)
at finishMaybe (/usr/local/lib/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js:630:14)
at endWritable (/usr/local/lib/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js:638:3)
at ConcatStream.Writable.end (/usr/local/lib/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js:594:41)
at DuplexWrapper.onend (/usr/local/lib/node_modules/browserify/node_modules/readable-stream/lib/_stream_readable.js:577:10)
at Object.onceWrapper (node:events:513:28)
I'm new to web development and feel like I'm forgetting something basic, or maybe there's an easier way than to use browserify. I would appreciate any help :).