-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathvite.config.ts
83 lines (71 loc) · 2.35 KB
/
vite.config.ts
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
import { fileURLToPath, URL } from "node:url"
import { defineConfig } from "vite"
import vue from "@vitejs/plugin-vue"
// Minify HTML
import { createHtmlPlugin } from "vite-plugin-html"
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
// Minify HTML
createHtmlPlugin({
minify: true,
}),
],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
// Cloudflare 向け環境変数
base: process.env.VUE_APP_BASE || "/klearsky",
build: {
// for `TypeError: xx is not a constructor`
// SEE: stackoverflow.com/a/73470097
// commonjsOptions: { include: [] },
chunkSizeWarningLimit: 600,
outDir: "docs",
rollupOptions: {
output: {
manualChunks (id: string) {
if (id.includes("@atproto_api"))
return "atproto-api"
if (id.includes("node_modules"))
return "vendor"
},
},
},
},
// ビルドプロダクションでは開発用のオブジェクトをドロップ
esbuild: {
drop: process.env.NODE_ENV === "production"
? ["console", "debugger"]
: [],
},
css: {
preprocessorOptions: {
scss: {
// NOTICE: 実体のある CSS を読み込まないこと
additionalData: "@use 'sass:map'; @use 'sass:math'; @import '@/scss/_variables.scss';",
// 下記の警告を抑制
// * `Deprecation Warning [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.`
// * `Deprecation Warning [legacy-js-api]: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.`
// * `Deprecation Warning [mixed-decls]: Sass's behavior for declarations that appear after nested rules will be changing to match the behavior specified by CSS in an upcoming version. To keep the existing behavior, move the declaration above the nested rule. To opt into the new behavior, wrap the declaration in \`& {}\`.`
// SEE: https://sass-lang.com/documentation/js-api/interfaces/deprecations/
silenceDeprecations: ["import", "legacy-js-api", "mixed-decls"],
},
},
postcss: {
plugins: [
require("autoprefixer"),
],
},
},
// for `TypeError: xx is not a constructor`
// SEE: stackoverflow.com/a/73470097
/*
optimizeDeps: {
disabled: false,
},
*/
})