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 · 0 comments
Open

Error parsing files using import attributes #2

zachleat opened this issue May 1, 2024 · 0 comments

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);
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

No branches or pull requests

1 participant