Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compat: failed to import "react" from ESM module #13200

Closed
Tracked by #12577
ghost opened this issue Dec 25, 2021 · 2 comments · Fixed by #13553
Closed
Tracked by #12577

compat: failed to import "react" from ESM module #13200

ghost opened this issue Dec 25, 2021 · 2 comments · Fixed by #13553
Assignees

Comments

@ghost
Copy link

ghost commented Dec 25, 2021

I try to use ink library from npm so i run npm install ink react and deno run --compat --unstable --allow-net --allow-read script.jsx

script.jsx

import React, {useState, useEffect} from 'react';
import {render, Text} from 'ink';

const Counter = () => {
	const [counter, setCounter] = useState(0);

	useEffect(() => {
		const timer = setInterval(() => {
			setCounter(previousCounter => previousCounter + 1);
		}, 100);

		return () => {
			clearInterval(timer);
		};
	}, []);

	return <Text color="green">{counter} tests passed</Text>;
};

render(<Counter />);

base on what i can understand from compatibility mode it must have no issues..., maybe i miss something ... i don't know here is output
output

@bartlomieju
Copy link
Member

This is most likely related to #12648; react is distributed as a CJS module and interoperability between ESM and CJS is still a bit lacking in Deno.

@bartlomieju bartlomieju changed the title compat: fail to import compat: failed to import "react" from ESM module Dec 27, 2021
@bartlomieju bartlomieju self-assigned this Jan 5, 2022
@bartlomieju
Copy link
Member

Okay, we got a way forward to providing this integration. Currently blocked by denoland/deno_graph#97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant