# import_attributes

> An import or re-export carries import attributes (with or assert).

An import or re-export carries import attributes (with or assert).

| | |
| --- | --- |
| Kind | Build or validation problem |
| Reported by | Archive and source validation |
| `disko` exit code | 1 (problems) |

An `import` or `export … from` carries import attributes, written with `with`
or the older `assert`. Attributes are not allowed; the file's extension alone
decides how it is loaded.

## Why it happens

Import attributes are mostly used to import JSON (`with { type: "json" }`).
JSON is not a package file type, so keep the data in a `.js` or `.ts` module.

## Wrong

```js title="src/main.js"
import levels from "./levels.json" with { type: "json" };
```

## Right

```js title="src/main.js"
import { levels } from "./levels.js";
```

## See also

- [Project structure & imports](/games/project-structure)
- [`extension_unsupported`](/errors/extension_unsupported)
