Skip to content

Commit 054b572

Browse files
committed
feat: add production check for component registration to prevent errors
1 parent ad7e37b commit 054b572

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/core/decorators/component/component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import type { IComponent } from 'jodit/types';
8+
import { IS_PROD } from 'jodit/core/constants';
89
import { getClassName } from 'jodit/core/helpers/utils/get-class-name';
910

1011
/**
@@ -51,7 +52,7 @@ export function component<T extends ComponentCompatible>(
5152

5253
const name = getClassName(constructorFunction.prototype);
5354

54-
if (componentRegistry.has(name)) {
55+
if (componentRegistry.has(name) && !IS_PROD) {
5556
throw new Error(`Component with name "${name}" is already registered`);
5657
}
5758

0 commit comments

Comments
 (0)