Closed jhnns closed 8 years ago
Check how you can use it on https://github.com/ava-ia/node-example
Yes, I know how to use it. This is the way how I've currently "fixed" it in my project. Now I have a dependency on babel although I don't use it.
This might be subjective but I'm pretty sure that many developers in the NPM community would consider it bad practice to publish a module which requires global variables to be polyfilled. My PR suggests a change, that users of your module would not need to use babel at all. Your module would be completely self-contained and everyone could use it without needing to install babel.
+1
I hit this issue when testing. This fix looks ideal.
🖖
Thx for this great module.
There is a small issue and I'm not sure if this is intended. If I just install the module from npm and execute it in node without using babel, it throws
This is because the compiled code requires some global variables, like
regeneratorRuntime
which you need to polyfill if you want to use the module without babel.I've added the babel-plugin-transform-runtime which translates these global dependencies into local requires. In this case, you don't need to polyfill the runtime environment anymore (like you did in the
index.js
).You'll need to build the code again of course. I haven't done that in this PR because I did not want to pollute it with generated code.