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

Prevent the Babel plugin from breaking the output of babel-node #374

Merged
merged 2 commits into from
Sep 22, 2016

Conversation

calesce
Copy link
Collaborator

@calesce calesce commented Sep 21, 2016

Closes #359.

The tagger code inserted by the babel plugin at the end of every file is an IIFE, which happens to break babel-node output when it's loaded. This happens because the code is added to every line that is evaluated by the REPL, so the lines now end with (function() { return; })(), which makes the REPL output undefined for every line.

By changing the IIFE from being wrapped in parens to a variable declaration, the output is no longer undefined for every line.

The tests pass and from manual testing it doesn't break anything. @nfcampos want to take a look?

Thanks to @loganfsmyth for the help on the Babel slack!

the tagger code inserted by the babel plugin at the end of every file is an IIFE, which
happens to break babel-node when it's loaded. by changing it to a
variable declaration (that is still immediately invoked), it works the
same way and doesn't break the plugin.
@loganfsmyth
Copy link

Glad it worked out!

@nfcampos
Copy link
Collaborator

@loganfsmyth this looks great! do we want to leave a comment in the code saying why we did this seemingly weird thing (assigning the result of a function that doesn't return anything to a variable we don't otherwise use)?

@calesce calesce merged commit 1058ad9 into gaearon:next Sep 22, 2016
@calesce calesce deleted the fix-babel-node branch September 22, 2016 01:57
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.

3 participants