arrow_backBACK TO DRILLS
Blue BeltarchitecturelockPREMIUM

The Module That Wasn't Really There

This client component imports a Node.js built-in module and calls a method on it inside a click handler.

REACT_MODULE // 0x42
'use client';

import fs from 'fs';

export default function FileReader() {
  const handleClick = () => {
    const stream = fs.createReadStream('/data/report.csv');
    stream.on('data', (chunk) => console.log(chunk));
  };
  return <button onClick={handleClick}>Read File</button>;
}

The import succeeds, but clicking the button throws "Module 'fs' has been externalized for browser compatibility." Why does the failure happen only on the method call?

lock

This Drill is Locked

This is a premium drill. Continue on to the next free drill in the sequence.

CONTINUE DRILLarrow_forward
BugDojo
BlogFAQ

© 2026. Carved in code.