# import_meta

> A module uses import.meta.

A module uses import.meta.

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

A module uses `import.meta`. Games have no module URL or file location to read
at run time, so `import.meta` is not allowed in any form.

## Why it happens

Code copied from browser or Node projects often uses `import.meta.url` to
build a path to a file, or `import.meta.env` for configuration.

## Wrong

```js title="src/main.js"
const puckUrl = new URL("./puck.png", import.meta.url);
```

## Right

```js title="src/main.js"
import puck from "./puck.png";
```

Import assets directly, and keep configuration as constants in a module.

## See also

- [Assets](/games/assets)
- [`import_dynamic`](/errors/import_dynamic)
