aboutsummaryrefslogtreecommitdiff
path: root/packages/astro/test/fixtures/astro-envs/astro.config.mjs
blob: 4b59505bc25c01be9412bb9b596fcd501b66abf1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import vue from '@astrojs/vue';
import { defineConfig } from 'astro/config';

// https://astro.build/config
export default defineConfig({
	site: 'http://example.com',
	base: '/blog',
	integrations: [vue()],
	vite: {
		plugins: [
			{
				// Plugin so that we can see in the tests whether the env has been injected
				name: 'export-env-plugin',
				enforce: 'post',
				transform(code, id) {
					if (id.endsWith('.json')) {
						return `${code}\n export const env = ${JSON.stringify(code.includes('CHESHIRE') || code.includes('process.env.KITTY') ? 'CHESHIRE' : 'A MYSTERY')}`;
					}
				},
			},
		],
	},
});