Working in windows, I'm able to generate a static site from my nuxt project using
$ npx nuxt generate
I'm interested in setting the output folder for the generated static files.
I'm reading through https://nuxtjs.org/api/configuration-generate which explains that I should be looking at the generate property. However, I don't understand how to modift or access the generate property. How cam I access the generate property?
EDIT; I changed the nuxt.config.js build object to :
build: {
publicPath: 'public/',
/*
** You can extend webpack config here
*/
extend(config, ctx) {
}
}
}
Then ran
$ npx nuxt generate
No public folder is generated
use below config into nuxt.config.js under module.exports, So your generate folder will be my-dist instead of dist
module.exports = {
mode: 'spa',
generate: {
dir: 'my-dist'
},
...............
.............
}
and if you want to use custom folder to keep all js,css and assests under dist folder for spa generate then use below config into nuxt.config.js under build object
publicPath: 'public/'
example:
build: {
publicPath: 'public/',
.........
............
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With