Cannot pass module functions to Page
问题 I have a module called util with the methods getMutedColor and some others. getMutedColor relies on another called rand in the same module. page.includeJs('https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.10/d3.min.js', function() { var util = require('./util'); var svg = page.evaluate(pageContext.pageExec, data, meta, util); /** ... **/ } I can call util.getMutedColor() just fine within this scope but in my pageContext.pageExec function, util.getMutedColor no longer exists. The util parameter