Importing JSON files with a different file extension fails as "Unknown module"
When trying to import a json file with import attributes that doesn't end with .json Deno gives the following error:
error: Expected a Json module, but identified a Unknown module.
Specifier: file:///C:/path/to/jsonfile.ldtk
error: Expected a Json module, but identified a Unknown module.
Specifier: file:///C:/path/to/jsonfile.ldtk
The code for importing it looks like this:
import jsonfile from './path/to/jsonfile.ldtk' with { type: 'json' };
import jsonfile from './path/to/jsonfile.ldtk' with { type: 'json' };
When renaming the file to .json and updating the import accordingly, it works as expected. Is this a known limitation, something I can work around, or a bug? I couldn't find anything on it.
Continue the conversation
Join the Discord to ask follow-up questions and connect with the community
D
Deno
Chat about Deno, a modern runtime for JavaScript and TypeScript.