0
0
mirror of https://github.com/Maks1mS/free-ozon-dpr.git synced 2024-12-23 18:42:59 +03:00
free-ozon-dpr/vite.config.js
2024-06-13 20:57:21 +03:00

51 lines
979 B
JavaScript

import webfontDownload from "vite-plugin-webfont-dl";
import { VitePluginRadar } from "vite-plugin-radar";
import htmlPlugin from "vite-plugin-html-config";
const metas = [];
const headScripts = [];
console.log(process.env.YANDEX_METRICA_ID)
if (process.env.YANDEX_VERIFICATION) {
metas.push({
name: "yandex-verification",
content: process.env.YANDEX_VERIFICATION,
});
}
if (process.env.YANDEX_METRICA_ID) {
headScripts.push(
`window.YANDEX_METRICA_ID=${process.env.YANDEX_METRICA_ID}`,
);
}
const PUBLIC_URL =
process.env.PUBLIC_URL || process.env.VERCEL_PROJECT_PRODUCTION_URL;
if (PUBLIC_URL) {
metas.push({
name: "og:url",
content: "https://" + PUBLIC_URL,
});
}
export default {
root: "src",
build: {
outDir: "../dist",
},
plugins: [
webfontDownload(),
VitePluginRadar({
metrica: {
id: process.env.YANDEX_METRICA_ID,
},
}),
htmlPlugin({
metas,
headScripts,
}),
],
};