-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
50 lines (49 loc) · 932 Bytes
/
vite.config.js
File metadata and controls
50 lines (49 loc) · 932 Bytes
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
import { defineConfig } from "vite";
import { resolve } from "path";
export default defineConfig({
build: {
outDir: "dist",
emptyOutDir: true,
rollupOptions: {
input: {
popup: resolve(__dirname, "src/popup.html"),
},
output: {
entryFileNames: "[name].js",
assetFileNames: (assetInfo) => {
if (assetInfo.name.endsWith(".css")) {
return "[name].css";
}
return "[name].[ext]";
},
chunkFileNames: "[name].js",
},
},
//handle ES modules
target: "esnext",
minify: "esbuild",
},
plugins: [
{
name: "move-html",
writeBundle() {
console.log(
"Build complete - HTML will be moved by post-build script"
);
},
},
],
server: {
port: 3000,
strictPort: true,
},
resolve: {
alias: {
"@": resolve(__dirname, "src"),
},
},
// define env whenever needed
define: {
__VERSION__: JSON.stringify(process.env.npm_package_version),
},
});