Failed to Load module Script

Any Idea what's the problem with the code that I am trying to run? This is the problem that occurs, it didn't load the javascript. Thanks Guys
8 Replies
b1mind
b1mind2y ago
Show us your loading of the script I'm assuming you forgot to add the attribute type="text/javascript" Learning what mime types are isn't talk about much but it's fascinating as the web is built with these namespaces/schemas
rig26.
rig26.2y ago
rig26.
rig26.2y ago
for html
rig26.
rig26.2y ago
For Script
rig26.
rig26.2y ago
rig26.
rig26.2y ago
basically this is the filepath I put this in default.php web/public/js/script.js is the path @b1mind
b1mind
b1mind2y ago
Does script export? Seems like it could be a esm issue? Not sure honestly. Do you have type: module in you package.json too? What php framework? Build tool etc?
WebMechanic
WebMechanic2y ago
unexpected token '<'
it's likely a server error spitting out HTML code instead of that .js file, which would explain the mime type error followed by the "unexpected token '<'". open the URL for the .js file directly in the browser, that'll either show the js code or a server error page. node_modules is not part of your "public" DocumentRoot and wouldn't be deployed. you're likely getting a 404 (html error) instead of the script. your bundler should actually copy that boostrap.js to the web folder as an external resource similar to what you have in the 'assets' folder
Want results from more Discord servers?
Add your server