browserify/brfs

Does not work with browserify -r option

chentsulin opened this issue · 4 comments

Below is my test.js :

var fs = require('fs');
var html = fs.readFileSync(__dirname + '/widget.html', 'utf8');
module.exports = Test;
function Test () {};

Use brfs without -r :

browserify -t brfs ./test.js

will get correctly compiled string :

var html = "<form class=\"send\">\n  <textarea type=\"text\" name=\"msg\"></textarea>\n  <input type=\"submit\" value=\"submit\">\n</form>";

But use with -r :

browserify -t brfs -r ./test.js:test 

fs code will not be compiled :

var html = fs.readFileSync(__dirname + '/widget.html', 'utf8');

What version of browserify? your code works with 5.11.2

I can reproduce this issue using browserify 6.3.2 / brfs 1.2.0.

I use browserify 6.3.2 / brfs 1.2.0, too

Not working with browserify@7 either.

Configuring brfs to be a global transform and it will perform the replacement properly.