cloudflare / cloudflare/workerd
🚀 Feature Request: support import with type syntax (standard now)
- Dominant language
- C++
- Stars
- 8.7k
- Forks
- 739
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 174
Description
### Describe the solution
Workers can import JSON like this:
```js
import Something from './file.json'
```
But you can't do that anywhere else.
This works in Chrome, Node, etc:
```js
import Something from './file.json' with {type: "json"}
```
But does not work in workers, you get:

It would be nice to have workers support "with type" so it can be used in various places without having to change it specifically for workers.
Spec: https://github.com/tc39/proposal-import-attributes
Supported almost everywhere: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#browser_compatibility
Contributor guide
Assessment
This issue has not been assessed yet.