Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Commented-out require() is not ignored #1

richardassar opened this Issue · 3 comments

2 participants


When commenting out a require the file is still pulled into the bundle.


I think it might require stripping all comments from source before processing.

For example

/* This block comment could cause problems
var example = require("example");

// As can single-line comments
// var example = require("example");

I had a look and comment removal is not as trivial as it might seem.

A naive approach might call for source.replace(/\/\*[\w\W]*\*\//g, '') to remove block comments, but this will fail when the block comment includes a regex with "*/" or "/*" inside. These cases might slightly rare, but not rare enough to ignore.

After a very quick google, this link seems to provide useful info on the subject.

Btw, really like this project. It is good to have some more options out there to Ender and Browserify.


Thanks for the info. I'm going to look into this: might be a better way to parse out the javascript rather than using regex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.