-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathastro.config.mjs
More file actions
82 lines (78 loc) · 1.87 KB
/
Copy pathastro.config.mjs
File metadata and controls
82 lines (78 loc) · 1.87 KB
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
import { defineConfig } from 'astro/config';
import svelte from '@astrojs/svelte';
// import nodejs from '@astrojs/node';
import sitemap from '@astrojs/sitemap';
import virtual from '@rollup/plugin-virtual';
import AstroPWA from '@vite-pwa/astro';
import manifest from './src/manifest.json';
import 'dotenv/config';
import * as path from 'path';
import * as url from 'url';
import tsconfig from './tsconfig.json';
// Get the current directory
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
// Get the aliases from tsconfig
const aliases = Object.entries(tsconfig.compilerOptions.paths).map(
([key, value]) => ({
find: key.replace(/\/\*$/, ''),
replacement: path.join(__dirname, value[0]).replace(/\/\*$/, ''),
}),
);
// Add custom aliases
aliases.push({
find: '$toolkit',
replacement: path.join(
__dirname,
'./node_modules/sass-toolkit/stylesheets/toolkit',
),
});
aliases.push({
find: '$breakpoint',
replacement: path.join(
__dirname,
'./node_modules/breakpoint-sass/stylesheets/breakpoint',
),
});
// https://astro.build/config
export default defineConfig({
site: 'https://chromeos.dev',
// output: 'hybrid',
// adapter: nodejs({
// mode: 'middleware',
// }),
integrations: [
svelte(),
sitemap(),
// eslint-disable-next-line new-cap
AstroPWA({
injectRegister: false,
manifest,
devOptions: {
enabled: true,
},
srcDir: './src',
filename: 'sw.js',
strategies: 'injectManifest',
injectManifest: {
globPatterns: [
'_astro/**/*.css',
'_astro/Offline*.js',
'pagefind/**/*',
'images/icons/**/*',
'offline/index.html',
],
},
}),
],
compressHTML: true,
vite: {
plugins: [
virtual({
'virtual:search': '',
}),
],
resolve: {
alias: aliases,
},
},
});