---
title: "@next/next/no-assign-module-variable"
description: "Disallow declaring a variable named `module`"
# Generated by src/codegen/lint-rule-docs.ts. Do not edit below this line.
plugin: "nextjs"
aliases: ["nextjs/no-assign-module-variable"]
kind: "problem"
category: "correctness"
default: "off"
fixable: "no"
typeAware: false
deprecated: false
---

The bundler gives every file a `module` object, and the code Next.js adds for hot reloading uses it. If you declare a variable named `module`, it hides that object, which can break the build or hot reloading.

The rule reports `var`, `let`, `const` and `using` declarations of `module`, anywhere in the file. It doesn't report parameters, destructuring, or an assignment to the existing `module`.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"@next/next/no-assign-module-variable" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad */}
```js
const module = await import("./charts.js");
module.render();
```

Not reported:

{/* good */}
```js
const charts = await import("./charts.js");
charts.render();
```

{/* good */}
```js
module.exports = { reactStrictMode: true };

function describe(module) {
  return module.id;
}
```
