Open dac3971 opened 5 years ago
@dac3971 If you want to use JS or CSS as a static asset, you must place it in the src/static folder and call it in the nuxt.config.js file in the head.
For example I has style.css file in the src/static/css folder and script.js in src/static/js folder then my nuxt.config.js file
module.exports = { srcDir: 'src', head: { title: 'Example', link: [ { rel: 'stylesheet', type: 'text/css', href: 'css/styles.css' } ], script: [ { src: "js/script.js" } ] }, }
@HendraPB Thanks for responding but I don't think we're talking about the same thing. I place my favicon in the static folder you're referring to. But what is giving me problems are the static files generated by Webpack - I believe this has to do with public path
in the nuxt.config.js build
property. It seems it is looking for them in the /
root but they aren't found there. I'm clearly missing something here.
@dac3971 I see, when I deploy to firebase I take static assets instead from /public but in src/static, so I don't use public folder.
See the firebase.json.example file in hosting.public, you can change it from "src/static"
to "public"
if you want to take static assets from /public
Hi, I got this to work but its just the unstyled html loading. Looks like the static assets (js, css) are returning a 404. I'm a beginner with Nuxt and any suggestions are greatly appreciated!