- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我有一个 Node.js Angular 应用程序,我正在尝试将 babylon.js 导入其中。
1) npm install --save babylonjs
将 npm 存储库安装到我项目的 Node 模块中。
The following image depicts the folder structure of the npm repo.
2) 在我的角度组件中,我从 babylon.module.d.ts
导入 BABYLON 声明和 babylon.max.js
上图中的文件就是这样。
import * as BABYLON from 'babylon.js'
Babylonjs now works great, has typings enabled and everything, so I can use BABYLON as pictured below
所有包含的扩展都没有连接。这些扩展位于以下文件夹中
(Full folder structure is in the first image. I left the gui folder open since that is the specific extension I am >trying to activate at this time)
主babylon.module.d.ts
文件定义 BABYLON 如下:
declare module BABYLON { //class types are defined in here }
gui 扩展(所有其他扩展遵循相同的逻辑)声明自己是 BABYLON 的一部分,如下所示:
declare module BABYLON.GUI { //extend classes & create new classes in here in here }
1) babylon.gui.d.ts 声明 BABYLON.GUI
所以我只是尝试了以下
import * as BABYLON from 'babylonjs';
import * as BABYLON.GUI from 'babylonjs/dist/preview release/gui/babylon.gui';
这会生成以下 Typescript 错误:Duplicate identifier 'BABYLON'
,然而,这并不奇怪,BABYLON.GUI is how the
babylon.gui.d.ts` 文件声明了它的部分。
2) 使用 index.html 文件中的 CDN。这可行,但是,类型将不起作用。即使我可以打字,使用 CDN 的性能也会降低。资源将加载到文档中 <head>
每一页。对于导入,只有在组件处于事件状态时才会查询资源。
3) 附加babylon.gui.d.ts
文件到 babylon.module.d.ts
文件。 BABYLON.GUI` 仍未定义。
Modifications to the npm repo are undesireable anyways, since any npm updates, or installs will overwrite the changes.
4) 我与 BABYLON 开发人员交谈过 here ,我们有点走进了死胡同。
有人对如何正确导入此扩展有任何意见吗?
附言。一旦我们得到这个答案,我将与开发人员合作,为所有希望将 babylon.js 合并到他们的项目中的 Node 用户实现无缝体验!
最佳答案
我与首席开发人员 deltakosh 谈过这个问题。
清除一些东西:
如果有人好奇here is the link到 github 上与此问题相关的公开问题。
在使用 Babylon 期间,我正在处理对导入包的导入支持,我做了以下工作:
对所有 babylon 库使用 CDN
要摆脱 typescript 编译问题,请在 .ts
文件的顶部声明以下内容,在此期间我们不会有任何打字优势。
如果您找到了更优雅的临时解决方案,请随时提出意见!
关于node.js - 在 Node 中导入扩展模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45227188/
当我这样做时... import numpy as np ...我可以使用它但是... import pprint as pp ...不能,因为我需要这样做... from pprint import
我第一次尝试将 OpenCV 用于 Python 3。要安装,我只需在终端中输入“pip3 install opencv-python”。当我这样做时,我在 Finder(我在 Mac 上)中看到,在
如果有一个库我将使用至少两种方法,那么以下之间在性能或内存使用方面是否有任何差异? from X import method1, method2 和 import X 最佳答案 有区别,因为在 imp
我正在从 lodash 导入一些函数,我的同事告诉我,单独导入每个函数比将它们作为一个组导入更好。 当前方法: import {fn1, fn2, fn3} from 'lodash'; 首选方法:
之间有什么关系: import WSDL 中的元素 -和- import元素和在 XML Schema ...尤其是 location 之间的关系前者和 schemaLocation 的属性后者的属性
我在从 'theano.configdefaults' 导入 'local_bitwidth' 时遇到问题。并显示以下消息: ImportError
我注意到 React 可以这样导入: import * as React from 'react'; ...或者像这样: import React from 'react'; 第一个导入 react
对于当前的项目,我必须使用矩阵中提供的信息并对其进行数学计算,以及使用 ITK/VTK 函数来显示医疗信息/渲染。基本上我必须以(我猜)50/50 的方式同时使用 matlab 例程和 VTK/ITK
当我看到 pysqlite 的示例时,SQLite 库有两个用例。 from sqlite3 import dbapi2 as sqlite3 和 import sqlite3 为什么有两种方式支持s
我使用 Anaconda Python 发行版:Python 2.7 x64 和 Windows 7 SP1 x64 Ultimate。 当我import matplotlib.pyplot时,我得到
目录 【容器】镜像导出/导入 导出 导入 带标签 不带标签,后期修改 【仓库】镜像导出/导入
我正在寻找一种导入模块的方法,以便我可以从子文件夹 project/v0 和根文件夹 project 运行脚本。/p> 我在 python 3.6 中的文件结构(这就是没有初始化文件的原因) proj
我通常被告知以下是不好的做法。 from module import * 主要原因(或者有人告诉我)是,您可能会导入一些您不想要的东西,并且它可能会隐藏另一个模块中具有类似名称的函数或类。 但是,Py
我为 urllib (python3) 编写了一个小包装器。在if中导入模块是否正确且安全? if self.response_encoding == 'gzip': import gzip
我正在 pimcore 中创建一个新站点。有没有办法导出/导入 pimcore 站点的完整数据,以便我可以导出 xml/csv 格式的 pimcore 数据进行必要的更改,然后将其导入回来? 最佳答案
在 Node JS 中测试以下模块布局,看起来本地导出的定义总是在名称冲突的情况下替换外部导出的定义(参见 B.js 中的 f1)。 A.js export const f1 = 'A' B.js e
我在使用 VBA 代码时遇到了一些问题,该代码应该将 excel 数据导入我的 Access 数据库。当我运行代码时,我收到一个运行时错误“运行时错误 438 对象不支持此属性或方法”。来自我在其他论
我有一个名为 elements 的包,其中包含按钮、trifader、海报等内容。在 Button 类中,我正在执行 from elements import * 这执行正常,当我尝试 print(p
在我长期使用 python 的经验中,我遇到了一个非常奇怪的问题。 提前我想说我想知道为什么会发生这种情况 ,而不是如何更改我的代码或如何修复它,因为我也可以做到。 我正在使用 python2.7.3
我正在更新我的包。但是,我正在为依赖项/导入而苦苦挣扎。我使用了两个冲突的包 - ggplot2和 psych及其功能 alpha当然还有 alpha ggplot2 的对象不同于 alpha psy
我是一名优秀的程序员,十分优秀!