-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.page-module.ts
41 lines (38 loc) · 1.06 KB
/
vite.config.page-module.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
import { fileURLToPath, URL } from "url";
import { defineConfig, loadEnv } from "vite";
import * as path from "path";
import { viteWebDockerFile } from "./src/plugin/plugin";
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());
const entries =
env.VITE_APP_REMOVE_HASH_FROM_ASSETS === "true"
? { entryFileNames: "assets/[name].js" }
: {};
return {
plugins: [
viteWebDockerFile({
basePath: "http://localhost:3010/page-module/",
entry: "src/fragment/page-module.ts",
module: "fragment-on-page",
type: "page",
selector: "fragment-on-page",
}),
],
build: {
outDir: "dist/fragment/page-module",
sourcemap: env.VITE_APP_SOURCE_MAPS_ENABLED !== "false",
rollupOptions: {
input: path.join(__dirname, "./src/fragment/page-module.ts"),
output: {
...entries,
format: "module",
},
},
},
resolve: {
alias: {
"~": fileURLToPath(new URL("./src", import.meta.url)),
},
},
};
});