remove crawlinks

This commit is contained in:
Kseninia Mikhaylova 2024-06-25 09:37:20 +03:00
parent ee43c0a58e
commit c2f9ab8f36
1 changed files with 33 additions and 33 deletions

View File

@ -5,34 +5,34 @@ import imagemin from 'imagemin';
import imageminPngquant from 'imagemin-pngquant';
export default defineNuxtConfig({
// hooks: {
// 'nitro:build:public-assets': async (nitro) => {
// console.log(`😈 custom hook imagemin in ${nitro.options.output.publicDir}`)
// const output_path = nitro.options.output.publicDir
// const filelist = await fs.readdir(output_path, { recursive: true });
// for (let index = 0; index < filelist.length; index++) {
// const element = filelist[index];
// const elementFile = await fs.lstat(`${output_path}/${element}`)
// if (element.startsWith('_nuxt')) continue
// if (elementFile.isFile()) {
// if (element.endsWith('.png')) {
// const dest = `${output_path}/${element.split('/').slice(0, -1).join('/')}`
// const res = await imagemin([`${output_path}/${element}`], {
// destination: dest,
// plugins: [
// imageminPngquant({
// quality: [0.6, 0.8]
// })
// ]
// })
// if (res.length) {
// console.log(chalk.gray(` compress PNG ${output_path}/${element}`))
// }
// }
// }
// }
// }
// },
hooks: {
'nitro:build:public-assets': async (nitro) => {
console.log(`😈 custom hook imagemin in ${nitro.options.output.publicDir}`)
const output_path = nitro.options.output.publicDir
const filelist = await fs.readdir(output_path, { recursive: true });
for (let index = 0; index < filelist.length; index++) {
const element = filelist[index];
const elementFile = await fs.lstat(`${output_path}/${element}`)
if (element.startsWith('_nuxt')) continue
if (elementFile.isFile()) {
if (element.endsWith('.png')) {
const dest = `${output_path}/${element.split('/').slice(0, -1).join('/')}`
const res = await imagemin([`${output_path}/${element}`], {
destination: dest,
plugins: [
imageminPngquant({
quality: [0.6, 0.8]
})
]
})
if (res.length) {
console.log(chalk.gray(` compress PNG ${output_path}/${element}`))
}
}
}
}
}
},
app: {
pageTransition: { name: 'page', mode: 'out-in' },
head: {
@ -62,11 +62,11 @@ export default defineNuxtConfig({
'/index.html': { redirect: '/' },
'/index.php': { redirect: '/' },
},
nitro: {
prerender: {
crawlLinks: true
},
},
// nitro: {
// prerender: {
// crawlLinks: true
// },
// },
vite: {
assetsInclude: ['**/*.glb', '**/*.gltf'],
build: {