Javascript “如何修复”;未捕获的语法错误:意外的标记{“quot;--clockify扩展

Javascript “如何修复”;未捕获的语法错误:意外的标记{“quot;--clockify扩展,javascript,node.js,google-chrome-extension,clockify,Javascript,Node.js,Google Chrome Extension,Clockify,目前,我正在尝试使用clockify API()为现有MantisHub集成添加功能。我在“src/helpers/integration helper.js”中添加了函数,以操作clockify项目和工作区。我希望在“src/integrations/MantisHub.js”中引用这些导出的函数,但尝试以下操作时: import {ProjectExists, createWorkspaceProject} from "../helpers/integration-helper"; (其

目前,我正在尝试使用clockify API()为现有MantisHub集成添加功能。我在“src/helpers/integration helper.js”中添加了函数,以操作clockify项目和工作区。我希望在“src/integrations/MantisHub.js”中引用这些导出的函数,但尝试以下操作时:

import {ProjectExists, createWorkspaceProject} from "../helpers/integration-helper";

(其中ProjectExists和createWorkspaceProjects是我添加的导出函数。)

我在chrome中遇到以下错误:

Uncaught SyntaxError: Unexpected toke {
我不确定我做错了什么(我对js比较陌生)

我尝试过使用动态导入,如下所示:

var helper_path = '../helpers/integration-helper';

        import(helper_path)
            .then(module => {

                //check if project exists
                var projectExists = module.ProjectExists(project);

                //create the project if it doesn't
                if(projectExists)
                {
                    //create project
                    module.createWorkspaceProject(project);

                    link = clockifyButton.createButton(description, project);
                }
                else
                {
                    link = clockifyButton.createButton(description);
                }
            })
            .catch(err => {

                    //create the button as normal
                    link = clockifyButton.createButton(description);
            });

但会出现以下错误:

Not allowed to load local resource
如何从mantishub.js集成中的其他模块导入/访问功能

谢谢大家!

2019年9月13日编辑-

以下是Clockify应用程序的存储库:


请提及
integration helper
文件中的代码您不能以本机方式使用内容脚本中的模块,除非您使用webpack或类似工具将代码编译成标准的单个捆绑包。本机动态导入(不通过webpack)也是如此,附加的限制是必须指定扩展名
.js
。@YasserMas我已经为Clockify应用程序提供了一个指向repo的链接——本机代码(没有我添加的函数)在/src/helpers/中。我编写的函数与已存在于其中的导出函数,甚至是我无法调用的函数具有相同的特性。@wOxxOm谢谢--我不知道内容脚本是什么。如何以可移植的方式扩展内容脚本,而不必在Cloc设置的已建立的编译中增加大量开销kify在他们的原始回购协议中?我不能说,但那个扩展的自述文件说它应该被编译,所以我想你们应该这样做。