import path from 'path'; import { fileURLToPath } from 'url'; import { defineConfig } from 'astro/config'; import sitemap from '@astrojs/sitemap'; import tailwind from '@astrojs/tailwind'; import mdx from '@astrojs/mdx'; import react from '@astrojs/react'; import partytown from '@astrojs/partytown'; import icon from 'astro-icon'; import compress from 'astro-compress'; import type { AstroIntegration } from 'astro'; import astrowind from './vendor/integration'; import { readingTimeRemarkPlugin, responsiveTablesRehypePlugin, lazyImagesRehypePlugin } from './src/utils/frontmatter'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const hasExternalScripts = false; const whenExternalScripts = (items: (() => AstroIntegration) | (() => AstroIntegration)[] = []) => hasExternalScripts ? (Array.isArray(items) ? items.map((item) => item()) : [items()]) : []; export default defineConfig({ output: 'static', site: 'https://www.365devnet.com', i18n: { locales: ["en", "de", "nl", "fr"], defaultLocale: "en", routing: { strategy: 'prefix-always', }, }, integrations: [ react({ include: ['**/react/*'], exclude: ['**/react/*.test.{js,jsx,ts,tsx}'], }), tailwind({ applyBaseStyles: false, config: { future: { hoverOnlyWhenSupported: true, }, }, }), sitemap({ changefreq: 'weekly', priority: 0.7, lastmod: new Date(), }), mdx({ drafts: false, syntaxHighlight: 'prism', rehypePlugins: [responsiveTablesRehypePlugin, lazyImagesRehypePlugin], }), icon({ include: { tabler: ['*'], 'flat-color-icons': [ 'template', 'gallery', 'approval', 'document', 'advertising', 'currency-exchange', 'voice-presentation', 'business-contact', 'database', ], 'circle-flags': ['*'], }, }), ...whenExternalScripts(() => partytown({ config: { forward: ['dataLayer.push'] }, }) ), compress({ CSS: true, HTML: { 'html-minifier-terser': { removeAttributeQuotes: false, collapseWhitespace: true, removeComments: true, minifyCSS: true, minifyJS: true, }, }, Image: { sharp: { quality: 80, progressive: true, }, }, JavaScript: { compress: true, mangle: true, format: { comments: false, }, }, SVG: false, Logger: 1, }), astrowind({ config: './src/config.yaml', }), ], image: { domains: ['cdn.pixabay.com', 'raw.githubusercontent.com'], service: { entrypoint: 'astro/assets/services/sharp', }, remotePatterns: [ { protocol: 'https', hostname: 'cdn.pixabay.com', }, { protocol: 'https', hostname: 'raw.githubusercontent.com', }, ], }, markdown: { remarkPlugins: [readingTimeRemarkPlugin], rehypePlugins: [responsiveTablesRehypePlugin, lazyImagesRehypePlugin], syntaxHighlight: 'prism', }, vite: { resolve: { alias: { '~': path.resolve(__dirname, './src'), }, }, build: { target: 'esnext', minify: 'terser', cssMinify: true, rollupOptions: { output: { manualChunks: { 'react-vendor': ['react', 'react-dom'], 'ui-vendor': ['@astrojs/react', '@astrojs/tailwind'], }, }, }, }, optimizeDeps: { include: ['react', 'react-dom'], }, }, });