Preloadjs integration problem

Hello, I want to add a JavaScript code to my pages with preloading. I don't encounter any issues with simple window commands. However, when I try to include a library (XState) and work with it, it doesn't work. I also tried creating a different query and testing the on-page-load option in advance mode, but that doesn't work either. When I run the entire code on a single query page, I can access the outputs without any problems. Do you have any suggestions for a solution?

const { createMachine, } = XState; 
const trafficLightMachine = createMachine({
  id: 'trafficLight',
  initial: 'red',
  states: {
    red: {
      on: {
        NEXT: 'green'
      }
    },
    yellow: {
      on: {
        NEXT: 'red'
      }
    },
    green: {
      on: {
        NEXT: 'yellow'
      }
    }
  }
});

For example, when I use the code 'return trafficLightMachine.initial' in the query screen along with the above codes, it works. However, when I move the above codes to preload, I get this message: 'message: "trafficLightMachine is not defined"'.

Hi @habip_okcu,

Thanks for reaching out! Can you share a screenshot of when you have the entire code on a single query page? Are you using XState in a custom component or a Javascript query? If it's in a Javascript query, can you share the link that you're using to import it?