LoginSignup
0
0

More than 5 years have passed since last update.

jsPlumb 2.0.3のnpmパッケージはisomorphicでない

Last updated at Posted at 2015-11-30

パッケージ名は全て小文字のjsplumbです。

npm i jsplumb

window.navigator依存のためNode.jsでは動きません

requireしてみます

index.js
var jsPlumb = require('jsplumb')
node index.js

window.navigator.userAgentに依存しているため、Node.jsでは実行できません。

/Users/shigerunakajima/jsPlumb_test/node_modules/jsplumb/dist/js/jsPlumb-2.0.3.js:627
        android: navigator.userAgent.toLowerCase().indexOf("android") > -1
                 ^

ReferenceError: navigator is not defined
    at Object.<anonymous> (/Users/shigerunakajima/jsPlumb_test/node_modules/jsplumb/dist/js/jsPlumb-2.0.3.js:627:18)
    at Object.<anonymous> (/Users/shigerunakajima/jsPlumb_test/node_modules/jsplumb/dist/js/jsPlumb-2.0.3.js:1202:4)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/Users/shigerunakajima/jsPlumb_test/index.js:1:77)
    at Module._compile (module.js:425:26)

最新のソースコードでも特に変わりません。

依存ライブラリが含まれないためbrowserifyでも動きません

browserify index.js -o bundle.js
index.html
<script src="bundle.js" charset="utf-8"></script>

index.htmlをブラウザで開くとエラーが起きます。

スクリーンショット 2015-12-01 0.25.34.png

ReferenceError (Mottle is not defined) · Issue #437 · sporritt/jsPlumb によると2.1.0で直るそうです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0