net::ERR_ABORTED 404 (Not Found) - and TailwindCSS

I have the following problem.

GET http://localhost:63342/Imc/src/public/js/script.js net::ERR_ABORTED 404 (Not Found).

This error occurs when I'm trying to import a modal in the script file type module as per print. And the index.html file is in SRC and the script.js in PUBLIC.

 

1 comment
Comment actions Permalink

The leading slashes in script URL ("/public/js/script.js") tell the browser to resolve URLs from the web server root. But the built-in web server serves files from http://localhost:63342/<project name>, so no resources can be loaded from http://localhost:63342 - thus the issue. There is unfortunately no way to set it up to use project root as server document root. I can only suggest using URLs relative to current .html file instead of URLs with leading slashes, or use a different web server to host your apps.

Note that we have added some fixes recently that make (most) of absolute paths work on the built-in web server, see https://youtrack.jetbrains.com/issue/WEB-11949/simplify-built-in-web-server-document-root-configuration#focus=Comments-27-5029164.0-0. But some problems still remain, see https://youtrack.jetbrains.com/issue/WEB-57280/Built-in-web-server-URL-links-in-CSS-dont-work-if-CSS-is-loaded-using-absolute-path-with-leading-slash, for example

0

Please sign in to leave a comment.