Prasanth
Prasanth

Reputation: 681

require('fs') not working with browserify

The following code generates error: Uncaught TypeError: undefined is not a function

 var fs = require('fs');

 fs.readFileSync(filename);

Upvotes: 2

Views: 4216

Answers (1)

mantoni
mantoni

Reputation: 1622

You have to use the brfs transform for this to work: https://github.com/substack/brfs

It will inline the file content into your script.

Upvotes: 3

Related Questions