I'm on a windows machine and I'm using browserify and gulp.
I want to remove the ./ in my require statements, is this possible?
Example:
Instead of require('./config.js'); I want it to be require('config.js');
My gulp file currently looks like this:
gulp.src('client/app.js')
.pipe(browserify({
paths: ['./node_modules', './client']
}))
.pipe(gulp.dest('website/public/js'))
.on('error', function (error) {
console.error('' + error);
});
If I try to compile the code:
var clientConfig = require('config.js');
then the result is literally "var clientConfig = require('config.js');" which isn't correct since it's supposed to include the contents.
If I use var clientConfig = require('./config.js'); then it works. Is there anyway to remove the ./ or is it required?
You can accomplish this using the pathmodify browserify plugin.