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
![](https://utfs.io/f/25f02b66-1eb9-4388-8a39-c6bb03ea2df9-1nq2cb.png)
8 Replies
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
![](https://utfs.io/f/d09a10af-1bf9-428e-94e5-f83008262de9-1nq2cb.png)
for html
For Script
![](https://utfs.io/f/8956cf39-0f07-4107-b38b-d8776203ca22-1nq2cb.png)
basically this is the filepath
I put this in default.php
web/public/js/script.js is the path
@b1mind
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?
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