import postCssGlobalData from '@csstools/postcss-global-data';
import ViteYaml from '@modyfi/vite-plugin-yaml';

import vue from '@vitejs/plugin-vue';
import postCssCustomMedia from 'postcss-custom-media';
import postCssNesting from 'postcss-nesting';
import vike from 'vike/plugin';

export default {
	plugins: [
		vue({
			template: {
				transformAssetUrls: {
					base: null,
					includeAbsolute: false,
				},
			},
		}),
		vike({
			redirects: {
				'/': '/updates',
			},
			trailingSlash: true, // for some reason /tags breaks without this, ERR_TOO_MANY_REDIRECTS
		}),
		ViteYaml(),
	],
	css: {
		postcss: {
			plugins: [
				postCssGlobalData({
					files: ['./assets/css/breakpoints.css'],
				}),
				postCssNesting(),
				postCssCustomMedia(),
			],
		},
	},
	resolve: {
		alias: {
			'#': __dirname,
			'#root': __dirname,
		},
	},
};
