Durante a tentativa de execução do index.js na aula 5 - Exibindo os Livros me deparei com o seguinte erro
ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and 'C:\Users\Monitora\Documents\treinamentoJsHelthClient\package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at file:///C:/Users/Monitora/Documents/treinamentoJsHelthClient/Ordena%C3%A7%C3%A3o/index.js:1:16
at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async loadESM (node:internal/process/esm_loader:28:7)
at async handleMainPromise (node:internal/modules/run_main:113:12)
Node.js v20.11.0
após eu alterar a linha de código 'type' do meu arquivo package.json de module para commonjs
"type": "commonjs",
funcionou! porque isso acontece?