Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

64 lines
2.0 KiB
TypeScript
Raw Permalink Normal View History

2025-01-27 10:07:35 +00:00
/*
Copyright 2025 New Vector Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig } from "vite";
2026-04-22 12:28:54 +00:00
import dts from "unplugin-dts/vite";
2025-07-24 16:27:09 +01:00
import externalGlobals from "rollup-plugin-external-globals";
2025-01-27 10:07:35 +00:00
2026-04-21 22:47:07 +01:00
import packageJson from "./package.json" with { type: "json" };
2025-01-27 10:07:35 +00:00
const __dirname = dirname(fileURLToPath(import.meta.url));
export default defineConfig({
build: {
lib: {
entry: resolve(__dirname, "src/index.ts"),
name: "element-web-plugin-engine",
fileName: "element-web-plugin-engine",
},
outDir: "lib",
target: "esnext",
sourcemap: true,
},
2025-07-24 16:27:09 +01:00
plugins: [
dts(),
externalGlobals({
// Reuse React from the host app
react: "window.React",
}),
],
2025-01-27 10:07:35 +00:00
define: {
2026-04-21 22:47:07 +01:00
// We cannot use `process.env.npm_package_version` as when building element-web with module-api set to `workspace`
// this would contain the version of element-web rather than that of the module-api.
__VERSION__: JSON.stringify(packageJson.version),
2025-07-24 16:27:09 +01:00
// Use production mode for the build as it is tested against production builds of Element Web,
// this is required for React JSX versions to be compatible.
process: { env: { NODE_ENV: "production" } },
2025-01-27 10:07:35 +00:00
},
2025-01-30 10:58:23 +00:00
test: {
coverage: {
provider: "v8",
include: ["src/**/*"],
reporter: [["lcov", { projectRoot: "../../" }]],
2025-01-30 10:58:23 +00:00
},
reporters: [
2026-03-11 14:42:06 +00:00
["default", { summary: false }],
2025-01-30 10:58:23 +00:00
[
"vitest-sonar-reporter",
{
outputFile: "coverage/sonar-report.xml",
onWritePath(path: string): string {
return `packages/element-web-module-api/${path}`;
},
},
],
],
},
2025-01-27 10:07:35 +00:00
});