Can't import a js on to another js uing wix and velo

I have been trying to import some global variables from a mainScript to a script dedicated to a page. I have been trying to import it and it detects it but it says that the variables I’m trying to use don’t exist in that script

I have two scripts

masterPage.js:

export var preguntas = ["pregunta 1", "pregunta 2", "pregunta 3"];
export var randomNumber = 0;
export var respuestas = [];

the scripts of the page I’m working on

import * as masterScript from "file:///public/masterPage.js";

$w.onReady(function () {
    $w("#Section1ListItem1Title1").text = masterScript.respuestas[0];
});

The error says:

Property ‘respuestas’ does not exist on type ‘typeof import(“file:///public/masterPage”)’.

masterPage.js is for code that should run on all pages.

If you want to share code between pages then make a new public .js file and place your code there: Where Do I Put My Code?

Also this thread addresses this question:

1 Like