TestCafe: ReferenceError: Cannot access 'ModuleName' before initialization

177 Views Asked by At

Im using testcafe for testing our page for now bout 1 year. On the latest version of our page, the devs used preloading and critical CSS for performance optimizations.

Since then i get an error on page startup:

ReferenceError: Cannot access 'ModuleName' before initialization

Is there a problem with TestCafe if a a page uses rel="modulepreload" to import js?

The DOM shows, that this module is part of a js-file that is preloaded like this. <link href="//cdn.test.local/version1/dist/script/something.static.js" rel="modulepreload">

-> link wont work since the page is on a local site.

Content of js-file: import{ModuleName}from'./classes/something.class.ajax.js';export const someAjaxPlugin=new ModuleName;

This Error does only occur if i run the page in testcafe... is that a bug? Any one an idea what i can do so my tests will run again?

0

There are 0 best solutions below