I am attempting to create a tool that logs the results of a user-flow's to the console.
I have not been able to import it into the CLI tool I am building on user-flow.
I have identified the code that I need to be able to do that and it is located at lighthouse/core/util.cjs as the Util class. However, it has recently been moved there and in the version of lighouse I am using it is located at 'lighthouse/report/renderer/util'
Therefore I need to import it from there and do so like this:
// @ts-ignore
import {Util} from 'lighthouse/report/renderer/util';
If I do not include the @ts-ignore I get this error:
Could not find a declaration file for module 'lighthouse/report/renderer/util'. '/Users/holder/Applications/user-flow/node_modules/lighthouse/report/renderer/util.js' implicitly has an 'any' type.
If the 'lighthouse' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'lighthouse/report/renderer/util';`ts(7016)
Could not find a declaration file for module 'lighthouse/report/renderer/util'. '/Users/holder/Applications/user-flow/node_modules/lighthouse/report/renderer/util.js' implicitly has an 'any' type.
If the 'lighthouse' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'lighthouse/report/renderer/util';`
and when i try to run the code afterwords i get this error:
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/holder/Applications/user-flow/node_modules/lighthouse/report/renderer/util.js
require() of ES modules is not supported.
require() of /Users/holder/Applications/user-flow/node_modules/lighthouse/report/renderer/util.js from /Users/holder/Applications/user-flow/dist/packages/cli/src/lib/commands/collect/utils/user-flow/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename util.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/holder/Applications/user-flow/node_modules/lighthouse/report/package.json.
at new NodeError (internal/errors.js:322:7)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1102:13)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:101:18)
at Object.<anonymous> (/Users/holder/Applications/user-flow/dist/packages/cli/src/lib/commands/collect/utils/user-flow/index.js:9:16)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32) {
code: 'ERR_REQUIRE_ESM'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
How can i import this class into my application?