节点npm – 在前端引用three.js模块
我目前正在使用节点npm来pipe理前端的jQuery的依赖关系。 使用以下方法。
服务器(工作)
app.use('/jquery', express.static(__dirname + '/node_modules/jquery/dist/'));
客户(工作)
<script src="/jquery/jquery.js"></script>
这工作,但我希望能够从服务器端pipe理依赖项“three.js”。 就像是…
服务器(不工作)
app.use('/three', express.static(__dirname + '/node_modules/three/dist/'));
客户端(不工作)
<script src="/three/three.js"></script>
错误()
服务器未能加载状态为404的服务器(未find)
我怎样才能findnpm模块的目录结构?
在three.js项目中,构build的文件位于build
目录中,而不是dist
。
在服务器上,这应该工作:
app.use('/three', express.static(__dirname + '/node_modules/three/build/'));