Suitescript 2.0 添加第三方库

Suitescript 2.0 Adding 3rd party libraries

我一直在 Youtube 上观看 Stoic Software 的教学视频,并尝试将以下内容上传到我的 Netsuite 帐户以测试第三方库的创建:

    /**
 * Prompts the user if the current project has not been re-baselined in some time
 *
 * @copyright 2020 Stoic Software, LLC
 * @author Eric T Grubaugh <eric@stoic.software>
 *
 * @NApiVersion 2.x
 * @NScriptType ClientScript
 * @NModuleScope Public
 * @NAmdConfig ./amdconfig.json
 * @appliedtorecord job
 */

define(["moment"], (moment) => {
  const message = "Project has not been re-baselined in over two months.";

  function pageInit(context) {
    let lastBaseline = moment(
      context.currentRecord.getValue({ fieldId: "lastbaselinedate" })
    );

    if (lastBaseline.isValid() && moment().diff(lastBaseline, "months") >= 2) {
      alert(message);
    }
  }

  return { pageInit };
});

这是与脚本位于同一位置的 amdconfig.json 文件:

    {
  "paths": {
    "moment": "./SuiteScripts/sdf_ignore/moment-with-locales.js"
  }
}

当我尝试创建脚本记录时,出现以下错误:

第 14 行如下:define(["moment"], (moment) => {

谁能看出是什么问题?

编辑:感谢@fullstack.studio 我能够上传脚本。

我收到以下错误消息,但它无法识别该功能:

我尝试使用的第三方库位于以下位置: https://momentjs.com/

我使用不带“.”的路径=> /SuiteScripts/...。这 '。'是对当前文件夹的引用。您可以删除 .js ext.

"paths": {
        "helper": "/SuiteScripts/My_Helper"
      }

在元中尝试使用 2.1 而不是 2.x

/**
....
 * @NApiVersion 2.1
....
 */