SyntaxError: "import declarations may only appear at top level of a module"

Hi All How to import Tripetto js library in js file i get the errror when i import the file is
SyntaxError: “import declarations may only appear at top level of a module”

Perhaps you should import it at the top level of your module.

i have imported at my .js file top level
please have look below code

import { Editor } from “tripetto”;
//import { Editor } from “survey/survey/public/js/tripetto-cli.js”;
// Copyright (c) 2019, Sangita and contributors
// For license information, please see license.txt
//import { Editor } from “/survey/survey/public/js/tripetto-cli.js”;

frappe.ui.form.on(“Survey”,
{
refresh: function(frm) {
frm.add_custom_button(__(‘Survey Editor’), function () {
// return frappe.call({
// doc: frm.doc,
// method: ‘open_new_editor’,
// callback: function() {
// frm.refresh();
// }
// });

		});
}

});

I’m guessing it is a problem with your execution environment.

If it was me, I would try that line (import { Editor } from “tripetto”;) in a copy of a module that also imports 3rd party modules and I that know definitely works. That way I can localize the problem to either my code, my environment or “tripetto” itself.