When will JSON import be supported in Edge Functions?

I mean, the import attributes feature.

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

Just curious. Is there any plan?

I’m currently running my build script with Node.js v22 and managing configurations in a JSON file, but it’s a bit inconvenient not to have direct access to configurations in Edge Functions.

Hi @juyuwol, welcome to the Vercel Community!

Edge Functions do not have filesystem access due to their ephemeral nature.

Have you considered using Vercel Edge Config, which is perfect for storing function configurations?

I was just wondering if support was planned.

Anyway, Edge Function can access .js javascript files. I can use it even now by adding export default in front of the JSON file and changing its extension. So why not just import plain JSON files, like Node.js and recent browsers do? I just assumed, rationally, that Edge Functions would likely support JSON modules at some point, so I was curious about the plan.

Hi @juyuwol, I see your point. Your solution to use .js files for configuration is a good one. But, filesystem support is not on the planning.

You can also look into Fluid compute where you can use the file system with Node.js runtime.

I hope this helps.

1 Like