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

Error when trying to use EUI with Observable Framework #7847

Open
Tracked by #7630
walterra opened this issue Jun 25, 2024 · 4 comments
Open
Tracked by #7630

Error when trying to use EUI with Observable Framework #7847

walterra opened this issue Jun 25, 2024 · 4 comments

Comments

@walterra
Copy link
Contributor

Describe the bug

I'm trying to use EUI with Observable Framework (https://observablehq.com/framework/what-is-framework). Observable Framework offers 2 ways to use js libraries, both seem to fail with EUI.

When trying to render EUI via npm:@elastic/eui I get the following error:

SyntaxError: The requested module '../../refractor@3.6.0/_esm.js' does not provide an export named 'highlight'

When trying to render EUI via node:@elastic/eui I get the following error:

TypeError: Failed to fetch dynamically imported module: http://127.0.0.1:3000/_node/@elastic/eui@95.2.0/index.js

Environment and versions

  • EUI version: 95.2.0
  • React version: 18.3.1
  • Observable Framework: 1.9.0

To Reproduce

Go through the steps of the tutorial to set up Observable Framework (https://observablehq.com/framework/getting-started):

yarn create @observablehq
cd hello-framework
yarn dev

Now update on of the existing md files like src/example-report.md and add the following lines:

```js
import {EuiProvider,EuiText} from "npm:@elastic/eui";
```

```jsx
display(
  <EuiProvider colorMode="light">
    <EuiText><p>Hello World!</p></EuiText>
  </EuiProvider>
);
```

This will render the following error:

SyntaxError: The requested module '../../refractor@3.6.0/_esm.js' does not provide an export named 'highlight'


Here's how to reproduce the error when installing EUI locally within the Observable Framework project.

# Stop the dev server if running, then install EUI:
yarn add @elastic/eui @elastic/datemath @emotion/react @emotion/css moment react react-dom

Then update the code in your markdown file and remove the npm: prefix from the import:

```js
import {EuiProvider,EuiText} from "@elastic/eui";
```

```jsx
display(
  <EuiProvider colorMode="light">
    <EuiText><p>Hello World!</p></EuiText>
  </EuiProvider>
);
```

This will render the following error:

TypeError: Failed to fetch dynamically imported module: http://127.0.0.1:3000/_node/@elastic/eui@95.2.0/index.js

Expected behavior

EUI imports should work and render the EUI components within Observable Framework pages.

@walterra walterra added bug ⚠️ needs validation For bugs that need confirmation as to whether they're reproducible labels Jun 25, 2024
@cee-chen
Copy link
Member

@walterra Do you mind clarifying if you're trying to use Observable Framework for an Elastic/Kibana project or for personal side use? That will help us determine priority/support.

@JasonStoltz
Copy link
Member

@walterra I'm unfamiliar with that framework. Were you able to find any additional context from Observable Framework docs or resources that could give us a clue to what is triggering those errors?

@walterra
Copy link
Contributor Author

walterra commented Jun 26, 2024

Hey! I came across this during ON Week and just wanted to document it should others come across it. It's definitely low priority from my point of view!

I'm suspecting it might be related to what others have seen in other contexts with how EUI builds/imports its icons.

@JasonStoltz JasonStoltz added known issue and removed ⚠️ needs validation For bugs that need confirmation as to whether they're reproducible labels Jun 26, 2024
@JasonStoltz
Copy link
Member

@walterra Rad! Thanks for reporting it in that case. We'll note it here.

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

No branches or pull requests

3 participants