Skip to content

Files

Latest commit

 

History

History
21 lines (15 loc) · 478 Bytes

no-assign-module-variable.md

File metadata and controls

21 lines (15 loc) · 478 Bytes

Pattern: Module variable assignment

Issue: -

Description

Assigning to the module variable in Next.js can cause unexpected behavior and break hot module replacement. Use exports or state management instead of modifying the module object directly.

Examples

Example of incorrect code:

module.value = "something";
module.exports.foo = "bar";

Example of correct code:

export const value = "something";
export const foo = "bar";