Skip to content
This repository was archived by the owner on Aug 4, 2021. It is now read-only.

Commit a7e7676

Browse files
committed
Fix usage with externalHelpers flag
1 parent 66f2f41 commit a7e7676

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function createBabelPluginFactory(customCallback = returnObject) {
105105
);
106106
}
107107

108-
if (helpers !== RUNTIME) {
108+
if (helpers !== RUNTIME && !externalHelpers) {
109109
transformOptions = addBabelPlugin(transformOptions, helperPlugin);
110110
}
111111

test/test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,6 @@ describe('rollup-plugin-babel', function() {
9191
});
9292
});
9393

94-
it('does not add helpers when externalHelpers option is truthy', () => {
95-
return bundle('samples/class/main.js').then(({ code }) => {
96-
assert.ok(code.indexOf('babelHelpers =') === -1, code);
97-
assert.ok(code.indexOf(`${HELPERS}.classCallCheck =`) === -1, code);
98-
});
99-
});
100-
10194
it('does not babelify excluded code', () => {
10295
return bundle('samples/exclusions/main.js', { exclude: '**/foo.js' }).then(({ code }) => {
10396
assert.ok(code.indexOf('${foo()}') === -1, code);
@@ -188,14 +181,21 @@ describe('rollup-plugin-babel', function() {
188181
});
189182
});
190183

191-
it('warns about deprecated usage with external-helper plugin', () => {
184+
it('allows using external-helpers plugin in combination with externalHelpers flag', () => {
185+
return bundle('samples/external-helpers/main.js', { externalHelpers: true }).then(({ code }) => {
186+
assert.ok(code.indexOf('function _classCallCheck') === -1);
187+
assert.ok(code.indexOf('babelHelpers.classCallCheck') !== -1);
188+
});
189+
});
190+
191+
it('warns about deprecated usage with external-helpers plugin (without externalHelpers flag)', () => {
192192
/* eslint-disable no-console */
193193
const messages = [];
194194
const originalWarn = console.warn;
195195
console.warn = msg => {
196196
messages.push(msg);
197197
};
198-
return bundle('samples/external-helpers-deprecated/main.js').then(() => {
198+
return bundle('samples/external-helpers/main.js').then(() => {
199199
console.warn = originalWarn;
200200

201201
assert.deepEqual(messages, [

0 commit comments

Comments
 (0)