尝试导入没有模块/包的javascript库

时间:2018-07-17 23:41:50

标签: javascript reactjs

我当前正在尝试导入称为PlayCanvas的WebGL引擎。它与three.js非常相似,但与public function index() { $all = []; $item_ict = Item::where('id_produk', '1')->get(); $item_cm = Item::where('id_produk', '2')->get(); for ($i = 0; $i < max($item_ict->count(), $item_cm->count()); $i++) { $all[] = [ isset($item_ict[$i]) ? $item_ict[$i] : null, isset($item_cm[$i]) ? $item_cm[$i] : null, ]; } return view('item/index', compact('all')); } <table class="table"> <thead> <tr> <th>ICT</th> <th>CM</th> </tr> </thead> <tbody> @foreach ($all as $items) <tr> <td>{{ $items[0] ? $items[0]->nama_item : null }}</td> <td>{{ $items[1] ? $items[1]->nama_item : null }}</td> </tr> @endforeach </tbody> </table> 不同;不幸的是,它没有npm软件包/捆绑包。通过我从这个StackOverflow获得的解决方案 solution;我下载了引擎代码并将其导入到我的React Component中。

奇怪的问题是我导入的three.js中有错误。我知道引擎代码是正确的事实,但是代码依赖于称为ammo.js的物理引擎,大多数playcanvas.min.js如下...

当我尝试将物理引擎not defined导入playcanvas引擎时,我的本地主机服务器崩溃并拒绝渲染任何东西。

ammo.js

我相信主要的问题是 Line 3: 'define' is not defined no-undef Line 4: 'define' is not defined no-undef Line 780: 'webkitAudioContext' is not defined no-undef Line 880: Unexpected use of 'self' no-restricted-globals Line 1125: 'Ammo' is not defined no-undef Line 1125: 'Ammo' is not defined no-undef Line 1125: 'Ammo' is not defined no-undef Line 1125: 'Ammo' is not defined no-undef<script src="https://code.playcanvas.com/playcanvas-latest.js"></script>

有很大不同

1 个答案:

答案 0 :(得分:0)

这看起来像个皮毛问题,请尝试使用eslint-config-playcanvas作为配置规则。这似乎禁用了与PlayCanvas环境相关的警告和错误。

有关如何操作的信息the instruction