Let me illustrate what I am attempting to achieve:
../src/Foo/Bar.ts
represents a local TypeScript file
This particular file contains code that is designed to function within a browser environment (it utilizes WebSockets
), and therefore needs to be executed in page.evaluate
page.evaluate( async () => {
const { namedExportExample } = await import('../src/Foo/Bar');
// ...
});
Upon running this, I encounter the error message
page.evaluate: TypeError: Failed to resolve module specifier
. This outcome was expected, as it seems unrealistic for the browser to evaluate such an import. Is there a potential workaround or solution available for this scenario?