ce7cb702218693d08ea6d83464d2457c9250027c
This commit is contained in:
commit
34c5f8963c
1 changed files with 145336 additions and 0 deletions
27
services/mail-keys/vite.config.ts
Normal file
27
services/mail-keys/vite.config.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { defineConfig } from "vite";
|
||||
|
||||
export default defineConfig({
|
||||
base: "/account/",
|
||||
build: {
|
||||
target: "es2023",
|
||||
modulePreload: { polyfill: false },
|
||||
},
|
||||
plugins: [{
|
||||
name: "runtime-licenses",
|
||||
generateBundle() {
|
||||
const packages = new Map<string, string>();
|
||||
for (const id of this.getModuleIds()) {
|
||||
const root = id.match(/(.*\/node_modules\/(?:@[^/]+\/)?[^/]+)/)?.[1];
|
||||
if (root) {
|
||||
const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf8")) as { name: string; version: string };
|
||||
packages.set(`${pkg.name}@${pkg.version}`, root);
|
||||
}
|
||||
}
|
||||
const notices = [...packages].sort(([left], [right]) => left.localeCompare(right))
|
||||
.map(([name, root]) => `${name}\n\n${readFileSync(join(root, "LICENSE"), "utf8")}`);
|
||||
this.emitFile({ type: "asset", fileName: "licenses.txt", source: notices.join("\n\n") });
|
||||
},
|
||||
}],
|
||||
});
|
||||
Loading…
Reference in a new issue