piuccio / cowsay

cowsay is a configurable talking cow
Other
1.13k stars 160 forks source link

Browserify fails to build #52

Open KevinWMatthews opened 4 years ago

KevinWMatthews commented 4 years ago

Hi,

I'm new to node and am trying to build cowsay in the browser using browserify. I'm encountering this error:

$ browserify clientCowsay.js -o bundle.js
Error: Cannot find module '.cows/ackbar.cow' from  '/my/dev/dir/node_modules/cowsay/build'

I've installed browserify to system, cowsay locally, and am using this JavaScript:

// clientCowsay.js
const cowsay = require('cowsay');
console.log(cowsay.say({text: "You don't say!"}));

Am I making a mistake or is there something out of sorts with the package?

Thanks!

piuccio commented 4 years ago

Browser support was added a while back in #26 I don't know if things have changed since then, but browserify should use the browser field in package.json. It looks like it's using the main instead. Is there any configuration in browserify to instruct on how to resolve modules?