RequireJS优化参考错误

发布于 2024-10-20 11:30:45 字数 1101 浏览 5 评论 0原文

我正在使用 RequireJS 来组织我的 JS 文件。我正在尝试将我的文件优化为一个主 JS 文件。

我正在使用以下命令来执行此操作:

/home/plugins/requireJS/build/build.sh name=main out=mesh-built.js baseUrl=/home/public_html/js/ includeRequire=true

该命令产生以下错误:

Tracing dependencies for: main

node.js:116
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
ReferenceError: $ is not defined
    at eval at <anonymous> (/home/plugins/requireJS/bin/../build/jslib/requirePatch.js:147:21)
    at Function.<anonymous> (eval at <anonymous> (/home/plugins/requireJS/bin/../build/jslib/requirePatch.js:147:21))
    at Function.load (/home/plugins/requireJS/bin/../build/jslib/requirePatch.js:147:21)
    at loadPaused (require.js:916:21)
    at require.js:958:21
    at Object.completeLoad (require.js:1207:17)
    at Function.load (/home/plugins/requireJS/bin/../build/jslib/requirePatch.js:150:29)
    at loadPaused (require.js:916:21)
    at require.js:958:21
    at Object.completeLoad (require.js:1207:17)

有谁知道为什么会产生此错误?

非常感谢。

I am using RequireJS to organise my JS files. I am attempting optimize my files into one main JS file.

I am using the following command to do this:

/home/plugins/requireJS/build/build.sh name=main out=mesh-built.js baseUrl=/home/public_html/js/ includeRequire=true

The command produces the following error:

Tracing dependencies for: main

node.js:116
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
ReferenceError: $ is not defined
    at eval at <anonymous> (/home/plugins/requireJS/bin/../build/jslib/requirePatch.js:147:21)
    at Function.<anonymous> (eval at <anonymous> (/home/plugins/requireJS/bin/../build/jslib/requirePatch.js:147:21))
    at Function.load (/home/plugins/requireJS/bin/../build/jslib/requirePatch.js:147:21)
    at loadPaused (require.js:916:21)
    at require.js:958:21
    at Object.completeLoad (require.js:1207:17)
    at Function.load (/home/plugins/requireJS/bin/../build/jslib/requirePatch.js:150:29)
    at loadPaused (require.js:916:21)
    at require.js:958:21
    at Object.completeLoad (require.js:1207:17)

Does anyone know why it would be producing this error?

Many thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清醇 2024-10-27 11:30:45

我认为这是要包含的文件顺序的问题。确保首先包含定义 $() 的 JS 文件。

I think its a problem with the order of the files to include. Make sure the JS file which defines the $() is included first.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文