Google 关闭 - goog.require 找不到 goog.structs.PriorityQueue

问题描述

我正在尝试使用 Google Closure 提供的 PriorityQueue 功能,但如果不使用 Closure Compiler,我似乎无法弄清楚如何做到这一点。由于我没有使用任何自定义模块,因此我似乎不需要使用编译器。

我的文件夹结构如下:

/Project/html/index.html
/Project/ThirdParty/closure-library

我的 index.html 文件包含:

<html>
<head>
    <!-- required Meta tags -->
    <Meta charset="utf-8">
    <Meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">

    <script type="text/javascript" src="../ThirdParty/closure-library/closure/goog/base.js"></script>
    <script>
        goog.require('goog.structs');
        goog.require('goog.structs.PriorityQueue');
    </script>
</head>
<body></body>
</html>

然而,上面给了我以下内容

goog.require Could not find: goog.structs
goog.require Could not find: goog.structs.PriorityQueue

我有点不明白为什么会发生这种情况,因为我的代码似乎与 https://developers.google.com/closure/library/docs/gettingstarted 中给出的示例一致

解决方法

你是如何检索图书馆的?如果你“npm install”你应该在 base.js 旁边有一个 deps.js 文件,它应该是你需要的一切。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...