/Users/jaylen/Desktop/ele-h5/node_modules/ts-node/dist/index.js:851
return old(m, filename);
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/jaylen/Desktop/ele-h5/commitlint.config.js from /Users/jaylen/Desktop/ele-h5/node_modules/cosmiconfig/dist/loaders.js not supported.
commitlint.config.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename commitlint.config.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /Users/jaylen/Desktop/ele-h5/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
at Object.require.extensions.<computed> [as .js] (/Users/jaylen/Desktop/ele-h5/node_modules/ts-node/dist/index.js:851:20)
at module.exports (/Users/jaylen/Desktop/ele-h5/node_modules/import-fresh/index.js:32:59)
at loadJs (/Users/jaylen/Desktop/ele-h5/node_modules/cosmiconfig/dist/loaders.js:16:18)
at Explorer.loadFileContent (/Users/jaylen/Desktop/ele-h5/node_modules/cosmiconfig/dist/Explorer.js:86:20)
at Explorer.createCosmiconfigResult (/Users/jaylen/Desktop/ele-h5/node_modules/cosmiconfig/dist/Explorer.js:94:36)
at Explorer.loadSearchPlace (/Users/jaylen/Desktop/ele-h5/node_modules/cosmiconfig/dist/Explorer.js:70:31)
at async Explorer.searchDirectory (/Users/jaylen/Desktop/ele-h5/node_modules/cosmiconfig/dist/Explorer.js:55:27)
at async run (/Users/jaylen/Desktop/ele-h5/node_modules/cosmiconfig/dist/Explorer.js:35:22)
at async cacheWrapper (/Users/jaylen/Desktop/ele-h5/node_modules/cosmiconfig/dist/cacheWrapper.js:16:18)
at async Explorer.search (/Users/jaylen/Desktop/ele-h5/node_modules/cosmiconfig/dist/Explorer.js:27:20)
at async loadConfig (/Users/jaylen/Desktop/ele-h5/node_modules/@commitlint/load/lib/utils/load-config.js:40:19)
at async load (/Users/jaylen/Desktop/ele-h5/node_modules/@commitlint/load/lib/load.js:19:20)
at async main (/Users/jaylen/Desktop/ele-h5/node_modules/@commitlint/cli/lib/cli.js:194:20) {
code: 'ERR_REQUIRE_ESM',
filepath: '/Users/jaylen/Desktop/ele-h5/commitlint.config.js'
}
husky - commit-msg hook exited with code 1 (error)