mathjs
次のようなカスタム バンドルがあります。
var core = require('mathjs/core');
var math = core.create();
math.import(require('mathjs/lib/type'));
math.import(require('mathjs/lib/function/arithmetic'));
math.import(require('mathjs/lib/function/trigonometry'));
math.import(require('mathjs/lib/expression'));
それをエクスポートします。次に試してみるとmath.eval('pi')
、例外が発生します。
Exception: Error: Undefined symbol pi
ライブラリ全体をインポートすると、このエラーは表示されませんmathjs
が、小さなカスタム バンドルの目的が無効になります。
質問math.eval('pi')
: 3.14 を返す最小のインポートは何ですか?