Skip to content
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

fix browserify transform append #1229

Merged

Conversation

graingert
Copy link
Contributor

No description provided.

return through(function(buf, enc, next) {
buf = buf.toString('utf8');
if (/plugins/.test(file)) {
buf += "\nrequire('../src/singleton').addPlugin(module.exports);";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's just luck that transform is getting called once with one buffer here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How so? It's completely valid through2 syntax.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so is through(process.exit) doesn't mean it's a good idea.

It's currently just luck that the current code works. If browserify presented you with a stream with multiple chunks you'd intersperse it with these require calls.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I completely missed the point and forgot that buffer size is limited. Good catch, thanks

@kamilogorek kamilogorek merged commit f4a2862 into getsentry:master Feb 14, 2018
@graingert graingert deleted the fix-browserify-transform-append branch February 14, 2018 12:40
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