Skip to content

Commit 8bd35c5

Browse files
committed
Add compatibility with ES6 modules
NodeJS stops supported automatic appending of ".js" when using ES modules. This PR makes it work in both ESM/CJS by putting it explicitely.
1 parent 14b855a commit 8bd35c5

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/ReactDOMServer.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
@module("react-dom/server")
1+
@module("react-dom/server.js")
22
external renderToString: React.element => string = "renderToString"
33

4-
@module("react-dom/server")
4+
@module("react-dom/server.js")
55
external renderToStaticMarkup: React.element => string = "renderToStaticMarkup"

src/ReactTestUtils.res

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ type undefined = Js.undefined<unit>
22

33
let undefined: undefined = Js.Undefined.empty
44

5-
@module("react-dom/test-utils")
5+
@module("react-dom/test-utils.js")
66
external reactAct: ((. unit) => undefined) => unit = "act"
77

88
let act: (unit => unit) => unit = func => {
@@ -13,40 +13,40 @@ let act: (unit => unit) => unit = func => {
1313
reactAct(reactFunc)
1414
}
1515

16-
@module("react-dom/test-utils")
16+
@module("react-dom/test-utils.js")
1717
external reactActAsync: ((. unit) => Js.Promise.t<'a>) => Js.Promise.t<unit> = "act"
1818

1919
let actAsync = func => {
2020
let reactFunc = (. ()) => func()
2121
reactActAsync(reactFunc)
2222
}
2323

24-
@module("react-dom/test-utils")
24+
@module("react-dom/test-utils.js")
2525
external isElement: 'element => bool = "isElement"
2626

27-
@module("react-dom/test-utils")
27+
@module("react-dom/test-utils.js")
2828
external isElementOfType: ('element, React.component<'props>) => bool = "isElementOfType"
2929

30-
@module("react-dom/test-utils")
30+
@module("react-dom/test-utils.js")
3131
external isDOMComponent: 'element => bool = "isDOMComponent"
3232

33-
@module("react-dom/test-utils")
33+
@module("react-dom/test-utils.js")
3434
external isCompositeComponent: 'element => bool = "isCompositeComponent"
3535

36-
@module("react-dom/test-utils")
36+
@module("react-dom/test-utils.js")
3737
external isCompositeComponentWithType: ('element, React.component<'props>) => bool =
3838
"isCompositeComponentWithType"
3939

4040
module Simulate = {
41-
@module("react-dom/test-utils") @scope("Simulate")
41+
@module("react-dom/test-utils.js") @scope("Simulate")
4242
external click: Dom.element => unit = "click"
43-
@module("react-dom/test-utils") @scope("Simulate")
43+
@module("react-dom/test-utils.js") @scope("Simulate")
4444
external clickWithEvent: (Dom.element, 'event) => unit = "click"
45-
@module("react-dom/test-utils") @scope("Simulate")
45+
@module("react-dom/test-utils.js") @scope("Simulate")
4646
external change: Dom.element => unit = "change"
47-
@module("react-dom/test-utils") @scope("Simulate")
47+
@module("react-dom/test-utils.js") @scope("Simulate")
4848
external blur: Dom.element => unit = "blur"
49-
@module("react-dom/test-utils") @scope("Simulate")
49+
@module("react-dom/test-utils.js") @scope("Simulate")
5050
external changeWithEvent: (Dom.element, 'event) => unit = "change"
5151
let changeWithValue = (element, value) => {
5252
let event = {
@@ -64,13 +64,13 @@ module Simulate = {
6464
}
6565
changeWithEvent(element, event)
6666
}
67-
@module("react-dom/test-utils") @scope("Simulate")
67+
@module("react-dom/test-utils.js") @scope("Simulate")
6868
external canPlay: Dom.element => unit = "canPlay"
69-
@module("react-dom/test-utils") @scope("Simulate")
69+
@module("react-dom/test-utils.js") @scope("Simulate")
7070
external timeUpdate: Dom.element => unit = "timeUpdate"
71-
@module("react-dom/test-utils") @scope("Simulate")
71+
@module("react-dom/test-utils.js") @scope("Simulate")
7272
external ended: Dom.element => unit = "ended"
73-
@module("react-dom/test-utils") @scope("Simulate")
73+
@module("react-dom/test-utils.js") @scope("Simulate")
7474
external focus: Dom.element => unit = "focus"
7575
}
7676

0 commit comments

Comments
 (0)