Skip to content

bundle: Inconsistent handling of json imports #30114

@ramnivas

Description

@ramnivas

Version: Deno 2.4.1

Consider the following index.js:

import data from "./data.json";

console.log(data)

Deno bundle succeeds:

$ deno bundle index.js         
⚠️ deno bundle is experimental and subject to changes
// data.json
var data_default = {};

// index.js
console.log(data_default);

But plain deno fails:

$ deno index.js       
error: Expected a JavaScript or TypeScript module, but identified a Json module. Consider importing Json modules with an import attribute with the type of "json".
  Specifier: file:///.../deno-issues/json-import/data.json
    at file:///.../deno-issues/json-import/index.js:1:18

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions