I recently created a single-page application (ssr: false) using NuxtJS. However, after building the project, I noticed that the file paths for the javascript and CSS files are relative to the domain's root folder instead of the dist folder. For example,
<script src="/_nuxt/e247009.js"></script>
. This caused a browser error:
"The resource from "the url" was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff)."
The paths within my css fonts-face also experienced this issue.
To resolve the error, I followed a solution provided here: , by adjusting the router option like this:
router: {
base: './'
}
However, now a new problem has emerged - when loading index.html
located in the project's root, the nuxt router displays an error:
This page could not be found
Is there a way to customize file paths without altering the router options to prevent breaking the router?