SyntaxError: export declarations may only appear at top level of a module on gnome shell extension

1.5k Views Asked by At

The settings of extension [email protected] had an error:

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

Stack trace:

@file:///home/rudra/.local/share/gnome-shell/extensions/[email protected]/prefs.js:28:16
_init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34

The code starts with (ignoring the comments for the first 25 lines)

const { Adw, Gdk, GLib, Gtk, Gio, GObject} = imports.gi;

const Config = imports.misc.config;  #This is line no: 28.

const Gettext = imports.gettext.domain('coverflow');
const _ = Gettext.gettext;

const Me = imports.misc.extensionUtils.getCurrentExtension();
const UIFolderPath = Me.dir.get_child('ui').get_path();
const ExtensionImports = Me.imports;
const Lib = ExtensionImports.lib;

const SCHEMA = "org.gnome.shell.extensions.coverflowalttab";

I have no knowledge on javascript. Can someone kindly let me know how to correct this error?

1

There are 1 best solutions below

0
andy.holmes On

It looks a lot like you're trying to use an extension from <= GNOME 44, on (a pre-release of) GNOME 45.

As of GNOME 45, GNOME Shell and extensions have migrated to ESModules. There is more information in the official blog post, Extensions in GNOME 45. If you're looking to port this extension, there is a guide to Port Extensions to GNOME Shell 45.