hparra / gulp-rename

Rename files easily
MIT License
692 stars 73 forks source link

file.base is undefined #48

Closed PeterKruzlics closed 8 years ago

PeterKruzlics commented 9 years ago

Hello,

I am using gulp-rename to rename a browserify bundle, and I am getting an "Arguments to path.join must be strings" error, which I managed to trace back to find that file.base is undefined (line 52 in index.js). I have been playing around with the rename function in gulp but haven't been able to set the file.base var any actual value. Can there be a default blank value so this error doesn't occur?

Thanks, Peter

yocontra commented 9 years ago

Can you make a repo that reproduces this issue with the minimum amount of code?

PeterKruzlics commented 9 years ago

I can, may take a while...

I continued fooling around with it and figured out why the file.base was returning undefined.

My code segment surrounding the rename function:

var browserify = require('browserify');
var source = require("vinyl-source-stream");
var rename = require('gulp-rename');

var b = browserify(conf);
b.bundle()
   .pipe(source('./vendor.js'))
   .pipe(rename({dirname: "", basename: "", extname: "vendor.js"}))

I had grabbed this template off of an example online which had stated that the source() part doesn't have to reference an actual file (just a random file name) since the file will get created with the browserified contents. However, when you have a file in there that doesn't exist, the file.base in gulp-rename is undefined.

I created an empty file and pointed the source() part to that, and now it works fine... not sure if that is sufficient information.

PeterKruzlics commented 9 years ago

Not sure if a check should be put in for that, but otherwise this issue was my bad and can probably be closed... Thanks!