2023-11-20 16:34:03 +00:00
|
|
|
import { defineConfig } from "rollup";
|
|
|
|
import { nodeResolve } from "@rollup/plugin-node-resolve";
|
|
|
|
import commonjs from "@rollup/plugin-commonjs";
|
|
|
|
import replace from "@rollup/plugin-replace";
|
|
|
|
import terser from "@rollup/plugin-terser";
|
2024-08-22 07:57:15 +00:00
|
|
|
import path from "node:path";
|
2023-11-20 16:34:03 +00:00
|
|
|
|
|
|
|
const plugins = [
|
|
|
|
nodeResolve(),
|
|
|
|
commonjs(),
|
|
|
|
replace({
|
|
|
|
preventAssignment: true,
|
|
|
|
// React depends on process.env.NODE_ENV to determine which code to include for production.
|
|
|
|
// This ensures that no additional code meant for development is included in the build.
|
2024-08-22 10:41:28 +00:00
|
|
|
"process.env.NODE_ENV": '"production"',
|
2023-11-20 16:34:03 +00:00
|
|
|
}),
|
|
|
|
terser(),
|
|
|
|
];
|
|
|
|
|
2024-08-22 07:57:15 +00:00
|
|
|
const targetDir = "target/classes/theme/keycloak/common/resources/vendor";
|
|
|
|
|
2023-11-20 16:34:03 +00:00
|
|
|
export default defineConfig([
|
|
|
|
{
|
|
|
|
input: [
|
|
|
|
"node_modules/react/cjs/react.production.min.js",
|
|
|
|
"node_modules/react/cjs/react-jsx-runtime.production.min.js",
|
|
|
|
],
|
|
|
|
output: {
|
2024-08-22 07:57:15 +00:00
|
|
|
dir: path.join(targetDir, "react"),
|
2023-11-20 16:34:03 +00:00
|
|
|
format: "es",
|
|
|
|
},
|
|
|
|
plugins,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
input: "node_modules/react-dom/cjs/react-dom.production.min.js",
|
|
|
|
output: {
|
2024-08-22 07:57:15 +00:00
|
|
|
dir: path.join(targetDir, "react-dom"),
|
2023-11-20 16:34:03 +00:00
|
|
|
format: "es",
|
|
|
|
},
|
|
|
|
external: ["react"],
|
|
|
|
plugins,
|
|
|
|
},
|
2024-10-03 10:51:23 +00:00
|
|
|
{
|
|
|
|
input: "src/main/js/web-crypto-shim.js",
|
|
|
|
output: {
|
|
|
|
dir: path.join(targetDir, "web-crypto-shim"),
|
|
|
|
format: "es",
|
|
|
|
},
|
|
|
|
plugins,
|
|
|
|
},
|
2023-11-20 16:34:03 +00:00
|
|
|
]);
|