Skip to content

Commit ee171ab

Browse files
author
Edward Xiao
committed
- check window type in message.ts
1 parent 9a0be59 commit ee171ab

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

lib/components/message.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,11 @@ var getCustomErrorMessage = function getCustomErrorMessage(o, m) {
235235
};
236236

237237
exports.getCustomErrorMessage = getCustomErrorMessage;
238-
window.REACT_INPUTS_VALIDATION = window.REACT_INPUTS_VALIDATION || {}; // TODO: find a rewire way to handle non-export function
238+
239+
if (typeof window !== 'undefined') {
240+
window.REACT_INPUTS_VALIDATION = window.REACT_INPUTS_VALIDATION || {};
241+
} // TODO: find a rewire way to handle non-export function
242+
239243

240244
var handleCustomErrorMessage = function handleCustomErrorMessage(message, w) {
241245
var res;
@@ -254,6 +258,10 @@ var handleCustomErrorMessage = function handleCustomErrorMessage(message, w) {
254258
};
255259

256260
exports.handleCustomErrorMessage = handleCustomErrorMessage;
257-
message = handleCustomErrorMessage(message, window);
261+
262+
if (typeof window !== 'undefined') {
263+
message = handleCustomErrorMessage(message, window);
264+
}
265+
258266
var _default = message;
259267
exports.default = _default;

lib/react-inputs-validation.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/react-inputs-validation.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)