keycloak-scim/themes/rollup.config.js
Jon Koops 293333056f
Import React from import map (#32335)
Closes #24863

Signed-off-by: Jon Koops <jonkoops@gmail.com>
2024-08-22 10:41:28 +00:00

43 lines
1.1 KiB
JavaScript

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";
import path from "node:path";
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.
"process.env.NODE_ENV": '"production"',
}),
terser(),
];
const targetDir = "target/classes/theme/keycloak/common/resources/vendor";
export default defineConfig([
{
input: [
"node_modules/react/cjs/react.production.min.js",
"node_modules/react/cjs/react-jsx-runtime.production.min.js",
],
output: {
dir: path.join(targetDir, "react"),
format: "es",
},
plugins,
},
{
input: "node_modules/react-dom/cjs/react-dom.production.min.js",
output: {
dir: path.join(targetDir, "react-dom"),
format: "es",
},
external: ["react"],
plugins,
},
]);