-
Notifications
You must be signed in to change notification settings - Fork 87
Conversation
Oh and it changes |
@@ -46,7 +44,7 @@ describe( 'rollup-plugin-babel', function () { | |||
}); | |||
}); | |||
|
|||
it( 'adds helpers', function () { | |||
it.only( 'adds helpers', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove debug code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch! fixed
Looking good! Lots of improvements going down lately! 😉 |
Better handling of helpers
👍 Haven't tried it, but seems good. |
@Rich-Harris something is going wrong with this change I'm seeing the following for the function babelHelpers_createClass () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}(); This change is also making the function declarations end with a function babelHelpers_classCallCheck (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}; I think you should rename them to |
The renaming from `babelHelpers.foo =` to a function declaration `function babelHelpers_foo()` was incorrect as the helpers are defined as expressions. This puts back the helper functions being defined as function expressions but keeps the better-minifiable `babelHelpers_` bindings. See: rollup#19 (comment)
PR to fix the above: #31 |
This addresses #17 by allowing runtime helpers if applicable via a
runtimeHelpers: true
option. It's also a bit more permissive about helpers generally – it will only complain about the lack ofexternal-helpers-2
if helpers are in fact duplicated, and it will warn instead of throwing an error.It also points to some better documentation explaining why these are needed.
@Victorystick @eventualbuddha does this seem like the right direction?