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

Using FileAttachment from js imports? #1046

Closed
Fil opened this issue Mar 12, 2024 · 1 comment
Closed

Using FileAttachment from js imports? #1046

Fil opened this issue Mar 12, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Fil
Copy link
Contributor

Fil commented Mar 12, 2024

In the penguincount.js file it's possible to

import {FileAttachment} from "observablehq:stdlib";
const penguins = await FileAttachment("penguins.csv").csv();
export const count = penguins.length;

And in penguinscount.md:

import {count} from "./penguincount.js";
display(count);

However, this does not seem to register the penguins.csv file: in other words, the page only works (displays 344) if it also contains a reference to FileAttachment("penguins.csv").

@Fil Fil added the enhancement New feature or request label Mar 12, 2024
@mbostock
Copy link
Member

You need to say

import {FileAttachment} from "npm:@observablehq/stdlib";

Maybe we should disallow observablehq: imports. That’s only intended for internal use at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants