-
Notifications
You must be signed in to change notification settings - Fork 4
/
astro.config.mjs
92 lines (87 loc) · 2.36 KB
/
astro.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import { defineConfig } from "astro/config";
import postcssMergeQueries from "postcss-merge-queries";
import htmlMinify from "@frontendista/astro-html-minify";
import glsl from "vite-plugin-glsl";
import sitemap from "@astrojs/sitemap";
import * as dotenv from "dotenv";
dotenv.config();
function createDate() {
const now = new Date(),
year = now.getFullYear(),
month = now.getMonth() + 1,
date = now.getDate(),
hour = now.getHours(),
minute = now.getMinutes();
return `${year}${month}${date}${hour}${minute}`;
// return `${year}${month}${date}`;
}
const DATE = createDate(),
MODE = process.env.NODE_ENV,
SITE_URL = MODE === "production" ? process.env.PUBLIC_PROD_URL : process.env.PUBLIC_LOCAL_URL;
// ? process.env.PUBLIC_TEST_URL : process.env.PUBLIC_LOCAL_URL;
// ? process.env.PUBLIC_LOCAL_URL : process.env.PUBLIC_LOCAL_URL;
console.log(
`// --------------------------\n\n⚡️ ~ MODE : ${MODE}\n\n▕▔▔▔▔▔▔▔▔▔▔▔╲\n▕╮╭┻┻╮╭┻┻╮╭▕╮╲\n▕╯┃╭╮┃┃╭╮┃╰▕╯╭▏\n▕╭┻┻┻┛┗┻┻┛ ╰▏ ▏\n▕╰━━━┓┈┈┈╭╮▕╭╮▏\n▕╭╮╰┳┳┳┳╯╰╯▕╰╯▏\n▕╰╯┈┗┛┗┛┈╭╮▕╮┈▏\n\n// --------------------------`,
);
console.log(SITE_URL);
// https://astro.build/config
export default defineConfig({
markdown: {
drafts: true,
},
build: {
assets: "assets",
},
site: SITE_URL,
base: "/",
vite: {
plugins: [glsl()],
esbuild: {
drop: ["console", "debugger"],
},
build: {
assetsInlineLimit: 0,
chunkSizeWarningLimit: 100000000,
rollupOptions: {
output: {
assetFileNames: `assets/[ext]/[name].${DATE}[extname]`,
entryFileNames: `assets/js/build.${DATE}.js`,
},
},
cssCodeSplit: false,
},
css: {
postcss: {
plugins: [postcssMergeQueries],
},
},
server: {
open: true,
port: 8080,
},
preview: {
open: true,
port: 8080,
},
},
integrations: [
sitemap(),
htmlMinify({
reportCompressedSize: false,
htmlTerserMinifierOptions: {
removeComments: true,
removeTagWhitespace: false,
},
}),
],
server: {
open: true,
host: true,
port: 3000,
},
preview: {
open: true,
host: true,
port: 3000,
},
});