Skip to content

Commit 25a4157

Browse files
authored
fix uuid import path not working for modern bundler (#1339)
* fix uuid import path not working for modern bundler uuid Breaking Change: Starting with uuid v8, the subpaths like /v4 were removed from the official export list. Modern bundlers like Rspack and Webpack 5 strictly follow these rules and will throw a "Package subpath is not defined" error if you try to bypass them. Signed-off-by: Yulong Ruan <ruanyl@amazon.com> * fix Triggers unit test Signed-off-by: Yulong Ruan <ruanyl@amazon.com> --------- Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
1 parent 0a6a993 commit 25a4157

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

public/pages/MonitorDetails/containers/Triggers/Triggers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import React, { Component } from 'react';
77
import PropTypes from 'prop-types';
8-
import uuidv4 from 'uuid/v4';
8+
import { v4 as uuidv4 } from 'uuid';
99
import { EuiInMemoryTable } from '@elastic/eui';
1010
import _ from 'lodash';
1111

public/pages/MonitorDetails/containers/Triggers/Triggers.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ const props = {
1818
updateMonitor: jest.fn(),
1919
};
2020

21-
jest.mock('uuid/v4', () => {
21+
jest.mock('uuid', () => {
2222
let value = 0;
23-
return () => value++;
23+
return {
24+
v4: () => value++,
25+
};
2426
});
2527

2628
function getShallowWrapper(customProps = {}) {

0 commit comments

Comments
 (0)