【问题标题】:require.js cannot find jquery.jsrequire.js 找不到 jquery.js
【发布时间】:2012-07-27 01:26:06
【问题描述】:

我们已经使用 require.js 进行了 AMD 实现,该实现已经使用了很长时间,现在团队决定使用 r.js 优化器来优化构建。我正在按照步骤操作,但我认为我遗漏了一些东西:

我们有 require.config,如下所示:

require.config({
    waitSeconds : 15,
    baseUrl: window.rootPath + 'scripts',
    paths: {
        jquery: 'empty:',
        jqueryui: 'empty:',
        recaptcha: '//www.google.com/recaptcha/api/js/recaptcha_ajax',
        maxmind: '//j.maxmind.com/app/geoip',
        enduser: '/enduser/scripts/system',
        cookies: '/enduser/scripts/system/cookies',
        errorhandler: '/enduser/scripts/system/errorhandler',
        underscore: '/enduser/scripts/underscore',
        blockui: '/enduser/scripts/jquery.blockui',
        messaging: '/enduser/scripts/system/messaging',
        jgrowl: '/enduser/scripts/jquery.jgrowl',
        knockout: 'knockout-latest.debug',
        kobindings: '/enduser/scripts/system/bindings',
        async: 'plugins/require/async',
        depend: 'plugins/require/depend',
        font: 'plugins/require/font',
        goog: 'plugins/require/goog',
        image: 'plugins/require/image',
        json: 'plugins/require/json',
        noext: 'plugins/require/noext',
        mdown: 'plugins/require/mdown',
        propertyParser: 'plugins/require/propertyParser',
        markdownConverter: 'lib/Markdown.Converter'
    },
    priority: ['jquery']
});

require(["main"]);

请注意,它有 CDN 路径而不是“空”。但是在网上阅读了一些帖子后,我将那里替换为空。我正在运行以下命令:

node -o name="filepath" output="output file path"

它说跟踪依赖关系,然后它抛出一个错误,说它没有找到 jquery.js。有什么建议吗?

【问题讨论】:

  • 这个问题的解决方案基本上是在命令末尾包含 paths.jquery=empty: 。所以我的命令看起来像node -o name="filepath" output="output file path" paths.jquery=empty:。这也适用于您使用的任何 CDN,包括 Jquery。

标签: javascript requirejs amd


【解决方案1】:

这个问题的解决方案基本上是在命令末尾包含 paths.jquery=empty: 。所以我的命令看起来像 node -o name="filepath" output="output file path" paths.jquery=empty:。这也适用于您使用的任何 CDN,包括 Jquery。

【讨论】:

    猜你喜欢
    • 2014-12-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-17
    • 2016-02-07
    • 2014-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多