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 parsing files using import attributes #2

Open
zachleat opened this issue May 1, 2024 · 2 comments · May be fixed by #3
Open

Error parsing files using import attributes #2

zachleat opened this issue May 1, 2024 · 2 comments · May be fixed by #3

Comments

@zachleat
Copy link
Member

zachleat commented May 1, 2024

Notably, this feature is not yet stable in Node.js: https://nodejs.org/docs/latest/api/esm.html#import-attributes

import data from './data.json' with { type: 'json' };

Upstream issue: acornjs/acorn#1289

@what1s1ove said it best: 11ty/eleventy#3128 (comment)

The easiest workaround is to use require in ESM as @uncenter notes here 11ty/eleventy#3128 (comment):

import { createRequire } from "node:module";
const require = createRequire(import.meta.url);
@what1s1ove
Copy link

Hey @zachleat !
I guess now we can resolve it 🙂
acornjs/acorn@3c6a5a9

@captainbrosset
Copy link

This issue has preventing us from testing the web-features-explorer site locally for some time, so I'm very happy to see Acorn get support for import attributes!
Has eleventy been updated to incorporate this upstream fix already?

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

Successfully merging a pull request may close this issue.

3 participants