我使用 bower install Threejs
安装了 Three.js。
然后,我希望在我的页面中包含 Three.js,因此我的 app.js 文件以以下内容开头:
define(["jquery", "three"], function() {
"use strict";
但是,当我的页面加载时,Chrome 控制台显示:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/scripts/three.js
Uncaught Error: Script error
那么,它不应该像 jQuery 一样查找组件吗?
基本上,我如何开始使用 yeoman 并安装 Three.js?
最佳答案
解决方法如下。
app.js 文件需要引用上面的“三”,这指的是具有以下内容的文件 main.js。
require.config({
paths: {
jquery: '../components/jquery/jquery',
three: '../components/threejs/build/three'
},
shim: {
bootstrap: {
deps: ['jquery'],
exports: 'jquery'
}
}
});
这里的关键是三个,它指向 Threejs Three.js 文件所在的位置。
关于node.js - 如何开始使用 yeoman 和 Three.js?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15595640/