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

🚀 Feature Request: support import with type syntax (standard now) #7893

Open
treeder opened this issue Jan 24, 2025 · 0 comments
Open

🚀 Feature Request: support import with type syntax (standard now) #7893

treeder opened this issue Jan 24, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@treeder
Copy link

treeder commented Jan 24, 2025

Describe the solution

Workers can import JSON like this:

import Something from './file.json'

But you can't do that anywhere else.

This works in Chrome and node, etc:

import Something from './file.json'  with {type: "json"}

But does not work in workers, you get:

Image

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

@treeder treeder added the enhancement New feature or request label Jan 24, 2025
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Untriaged
Development

No branches or pull requests

1 participant