Skip to content

Commit d80824f

Browse files
alexeyr-cialexeyr
andauthored
Disable esModuleInterop (#1699)
Co-authored-by: Alexey Romanov <[email protected]>
1 parent 923525d commit d80824f

14 files changed

+23
-22
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Changes since the last non-beta release.
2020

2121
#### Fixed
2222
- Fix obscure errors by introducing FULL_TEXT_ERRORS [PR 1695](https://github.com/shakacode/react_on_rails/pull/1695) by [Romex91](https://github.com/Romex91).
23+
- Disable `esModuleInterop` to increase interoperability [PR 1699](https://github.com/shakacode/react_on_rails/pull/1699) by [alexeyr-ci](https://github.com/alexeyr-ci).
2324

2425
### [14.1.1] - 2025-01-15
2526

node_package/src/clientStartup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ReactDOM from 'react-dom';
1+
import * as ReactDOM from 'react-dom';
22
import type { ReactElement } from 'react';
33
import type {
44
RailsContext,

node_package/src/createReactOutput.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable react/prop-types */
22

3-
import React from 'react';
3+
import * as React from 'react';
44
import type { ServerRenderResult,
55
CreateParams, ReactComponent, RenderFunction, CreateReactOutputResult } from './types/index';
66
import {isServerRenderHash, isPromise} from "./isServerRenderResult";

node_package/src/handleError.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import React from 'react';
2-
import ReactDOMServer from 'react-dom/server';
1+
import * as React from 'react';
2+
import * as ReactDOMServer from 'react-dom/server';
33
import type { ErrorOptions } from './types/index';
44

55
function handleRenderFunctionIssue(options: ErrorOptions): string {

node_package/src/reactApis.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ReactDOM from 'react-dom';
1+
import * as ReactDOM from 'react-dom';
22

33
const reactMajorVersion = Number(ReactDOM.version?.split('.')[0]) || 16;
44

node_package/src/reactHydrateOrRender.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ReactElement } from 'react';
2-
import ReactDOM from 'react-dom';
2+
import * as ReactDOM from 'react-dom';
33
import type { RenderReturnType } from './types';
44
import { supportsRootApi } from './reactApis';
55

node_package/src/serverRenderReactComponent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ReactDOMServer from 'react-dom/server';
1+
import * as ReactDOMServer from 'react-dom/server';
22
import type { ReactElement } from 'react';
33

44
import ComponentRegistry from './ComponentRegistry';

node_package/src/streamServerRenderedReactComponent.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ReactDOMServer, { type PipeableStream } from 'react-dom/server';
1+
import * as ReactDOMServer from 'react-dom/server';
22
import { PassThrough, Readable } from 'stream';
33
import type { ReactElement } from 'react';
44

@@ -34,8 +34,8 @@ const transformRenderStreamChunksToResultObject = (renderState: StreamRenderStat
3434
}
3535
});
3636

37-
let pipedStream: PipeableStream | null = null;
38-
const pipeToTransform = (pipeableStream: PipeableStream) => {
37+
let pipedStream: ReactDOMServer.PipeableStream | null = null;
38+
const pipeToTransform = (pipeableStream: ReactDOMServer.PipeableStream) => {
3939
pipeableStream.pipe(transformStream);
4040
pipedStream = pipeableStream;
4141
};

node_package/tests/ComponentRegistry.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
/* eslint-disable no-unused-vars */
66
/* eslint-disable import/extensions */
77

8-
import React from 'react';
9-
import createReactClass from 'create-react-class';
8+
import * as React from 'react';
9+
import * as createReactClass from 'create-react-class';
1010

1111
import ComponentRegistry from '../src/ComponentRegistry';
1212

node_package/tests/ReactOnRails.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
/* eslint-disable react/jsx-filename-extension */
55

66
import { createStore } from 'redux';
7-
import React from 'react';
8-
import createReactClass from 'create-react-class';
7+
import * as React from 'react';
8+
import * as createReactClass from 'create-react-class';
99
import ReactOnRails from '../src/ReactOnRails';
1010

1111
describe('ReactOnRails', () => {

0 commit comments

Comments
 (0)