Skip to content

Commit

Permalink
Disable esModuleInterop (#1699)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexey Romanov <[email protected]>
  • Loading branch information
alexeyr-ci and alexeyr authored Feb 26, 2025
1 parent 923525d commit d80824f
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Changes since the last non-beta release.

#### Fixed
- 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).
- Disable `esModuleInterop` to increase interoperability [PR 1699](https://github.com/shakacode/react_on_rails/pull/1699) by [alexeyr-ci](https://github.com/alexeyr-ci).

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

Expand Down
2 changes: 1 addition & 1 deletion node_package/src/clientStartup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ReactDOM from 'react-dom';
import * as ReactDOM from 'react-dom';
import type { ReactElement } from 'react';
import type {
RailsContext,
Expand Down
2 changes: 1 addition & 1 deletion node_package/src/createReactOutput.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react/prop-types */

import React from 'react';
import * as React from 'react';
import type { ServerRenderResult,
CreateParams, ReactComponent, RenderFunction, CreateReactOutputResult } from './types/index';
import {isServerRenderHash, isPromise} from "./isServerRenderResult";
Expand Down
4 changes: 2 additions & 2 deletions node_package/src/handleError.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import ReactDOMServer from 'react-dom/server';
import * as React from 'react';
import * as ReactDOMServer from 'react-dom/server';
import type { ErrorOptions } from './types/index';

function handleRenderFunctionIssue(options: ErrorOptions): string {
Expand Down
2 changes: 1 addition & 1 deletion node_package/src/reactApis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ReactDOM from 'react-dom';
import * as ReactDOM from 'react-dom';

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

Expand Down
2 changes: 1 addition & 1 deletion node_package/src/reactHydrateOrRender.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ReactElement } from 'react';
import ReactDOM from 'react-dom';
import * as ReactDOM from 'react-dom';
import type { RenderReturnType } from './types';
import { supportsRootApi } from './reactApis';

Expand Down
2 changes: 1 addition & 1 deletion node_package/src/serverRenderReactComponent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import type { ReactElement } from 'react';

import ComponentRegistry from './ComponentRegistry';
Expand Down
6 changes: 3 additions & 3 deletions node_package/src/streamServerRenderedReactComponent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ReactDOMServer, { type PipeableStream } from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import { PassThrough, Readable } from 'stream';
import type { ReactElement } from 'react';

Expand Down Expand Up @@ -34,8 +34,8 @@ const transformRenderStreamChunksToResultObject = (renderState: StreamRenderStat
}
});

let pipedStream: PipeableStream | null = null;
const pipeToTransform = (pipeableStream: PipeableStream) => {
let pipedStream: ReactDOMServer.PipeableStream | null = null;
const pipeToTransform = (pipeableStream: ReactDOMServer.PipeableStream) => {
pipeableStream.pipe(transformStream);
pipedStream = pipeableStream;
};
Expand Down
4 changes: 2 additions & 2 deletions node_package/tests/ComponentRegistry.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
/* eslint-disable no-unused-vars */
/* eslint-disable import/extensions */

import React from 'react';
import createReactClass from 'create-react-class';
import * as React from 'react';
import * as createReactClass from 'create-react-class';

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

Expand Down
4 changes: 2 additions & 2 deletions node_package/tests/ReactOnRails.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
/* eslint-disable react/jsx-filename-extension */

import { createStore } from 'redux';
import React from 'react';
import createReactClass from 'create-react-class';
import * as React from 'react';
import * as createReactClass from 'create-react-class';
import ReactOnRails from '../src/ReactOnRails';

describe('ReactOnRails', () => {
Expand Down
4 changes: 2 additions & 2 deletions node_package/tests/renderFunction.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/* eslint-disable react/prefer-stateless-function */
/* eslint-disable react/jsx-filename-extension */

import React from 'react';
import createReactClass from 'create-react-class';
import * as React from 'react';
import * as createReactClass from 'create-react-class';

import isRenderFunction from '../src/isRenderFunction';

Expand Down
2 changes: 1 addition & 1 deletion node_package/tests/serverRenderReactComponent.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable react/jsx-filename-extension */
/* eslint-disable no-unused-vars */

import React from 'react';
import * as React from 'react';

import serverRenderReactComponent from '../src/serverRenderReactComponent';
import ComponentRegistry from '../src/ComponentRegistry';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* @jest-environment node
*/

import React, { Suspense } from 'react';
import PropTypes from 'prop-types';
import * as React from 'react';
import * as PropTypes from 'prop-types';
import streamServerRenderedReactComponent from '../src/streamServerRenderedReactComponent';
import ComponentRegistry from '../src/ComponentRegistry';

Expand All @@ -23,9 +23,9 @@ const TestComponentForStreaming = ({ throwSyncError, throwAsyncError }) => {
return (
<div>
<h1>Header In The Shell</h1>
<Suspense fallback={<div>Loading...</div>}>
<React.Suspense fallback={<div>Loading...</div>}>
<AsyncContent throwAsyncError={throwAsyncError} />
</Suspense>
</React.Suspense>
</div>
);
};
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"allowJs": true,
"esModuleInterop": true,
"esModuleInterop": false,
"jsx": "react-jsx",
"lib": ["dom", "es2015"],
"module": "CommonJS",
Expand Down

0 comments on commit d80824f

Please sign in to comment.