Skip to content

Added whitespace handling to regexp. #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

whyj
Copy link

@whyj whyj commented Mar 15, 2017

This update adds whitespace handling to the matching regexp, as I've seen files in some node modules (e.g. JSONStream) contain extra whitespace before the shebang.

Allowing extra whitespace in the beginning is not really inline with the definition of shebangs, but making this loader a bit more generic allows using those files, instead of trying to fix every node module out there.

@JavascriptIsMagic
Copy link
Owner

Yes, this loader is mostly intended to be a workaround for these modules, and I don't see any problems with allowing whitespace before the shebang.

However in this PR you only changed the regexp in the if statement,
you also need to change line 4 so the \s* actually gets replaced.

If you wanted to do that in this PR I'll merge it in.

@whyj
Copy link
Author

whyj commented Mar 16, 2017

Great.

Funny how I missed it on line 4. I added it there too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants