简体   繁体   中英

Build turf.js with Browserify

I am trying to build a recent copy of turf-buffer which is a module of turf.js . I ran npm install turf-buffer and then browserify turf-buffer/index.js > turf.js . However, upon including the resulting turf.js in the html file (it is definitely there) and calling var buffered = turf.buffer(originalData, buf, 'meters'); I get the message turf is not defined . I have also tried turfjs.xxx , turf-buffer.xxx and various other combinations. If I try turfxxxx.yyy then I still get turf is not defined which suggests a fundamental turf object is missing. I presume this is a problem with the browserify build. Is there a flag I need to give to browserify or could it be a lack of package-specific instructions?

我已修复它-我需要使用-s指定一个入口点(不确定是否是正确的术语),因此最终命令是browserify turf-buffer/index.js -s turf.buffer > turf.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM