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

Library is not compatible with Edge runtime #175

Open
bmamouri opened this issue Oct 13, 2024 · 1 comment
Open

Library is not compatible with Edge runtime #175

bmamouri opened this issue Oct 13, 2024 · 1 comment

Comments

@bmamouri
Copy link

bmamouri commented Oct 13, 2024

I am trying to use gray-matter in Next.js edge runtime. But it seems that the library is not compatible with edge runtime. I am getting the following error:

Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime 
Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation

The error was caused by importing 'gray-matter/index.js' in './lib/api.ts'.

I get the error even when disabling eval:

  const {data, content} = matter(fileContents, {eval: false})

Is there any way to make this library edge friendly? Does anybody know any alternative that can be used with edge?

@s-light
Copy link

s-light commented Oct 22, 2024

for me it is only a warning currently with my quasar / vue / vite setup:

Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
Cannot call a namespace ('matter')
Cannot call a namespace ('matter')

but this warning also mentioned if i set the eval:false option..

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

2 participants