Skip to content

Commit e0a7329

Browse files
nikoshellpre-commit-ci[bot]egeakman
authored
Few tweaks to astro config. (#1068)
## Configuration Improvements ### Changes to `astro.config.mjs`: - Added build-time environment variable definition - Configured Vite alias for `$` to resolve from `./src` - Enabled minification for production builds - Added path resolution for `__dirname` in ES module context ### Updates to `tsconfig.json`: - Added TypeScript path alias for `$*` to map to `src/*` <!-- readthedocs-preview ep-website start --> 🖼️ Preview available 🖼️ : https://ep-website--1068.org.readthedocs.build/ <!-- readthedocs-preview ep-website end --> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ege Akman <[email protected]>
1 parent 1b374df commit e0a7329

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

astro.config.mjs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import path, { dirname } from "path";
2+
import { fileURLToPath } from "url";
13
import { defineConfig } from "astro/config";
24
import mdx from "@astrojs/mdx";
35
import { h } from "hastscript";
@@ -10,8 +12,21 @@ import rehypeAutolinkHeadings from "rehype-autolink-headings";
1012
import metaTags from "astro-meta-tags";
1113
import pagefind from "astro-pagefind";
1214

15+
const __filename = fileURLToPath(import.meta.url);
16+
const __dirname = dirname(__filename); // @type-check enabled!
17+
1318
// https://astro.build/config
1419
export default defineConfig({
20+
vite: {
21+
define: {
22+
"process.env.VITE_BUILD_TIME": JSON.stringify(new Date().toISOString()),
23+
},
24+
resolve: {
25+
alias: {
26+
$: path.resolve(__dirname, "./src"),
27+
},
28+
},
29+
},
1530
markdown: {
1631
remarkPlugins: [
1732
[
@@ -34,7 +49,7 @@ export default defineConfig({
3449
],
3550
],
3651
},
37-
site: "https://ep2025.europython.eu",
52+
site: process.env.SITE_URL || "https://ep2025.europython.eu",
3853
redirects: {
3954
"/c-api-summit/": "/programme/c-api-summit/",
4055
"/programme/cfp/": "/programme/cfp/",
@@ -56,4 +71,7 @@ export default defineConfig({
5671
pagefind(),
5772
],
5873
output: "static",
74+
build: {
75+
minify: true,
76+
},
5977
});

tsconfig.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
"compilerOptions": {
44
"strictNullChecks": true,
55
"jsx": "react-jsx",
6-
"jsxImportSource": "react"
6+
"jsxImportSource": "react",
7+
"paths": {
8+
"@components/*": ["src/components/*"],
9+
"@layouts/*": ["src/layouts/*"],
10+
"@ui/*": ["src/components/ui/*"],
11+
"@assets/*": ["src/assets/*"],
12+
"@i18n/*": ["src/i18n/*"],
13+
"@src/*": ["src/*"]
14+
}
715
}
816
}

0 commit comments

Comments
 (0)