From b91d7f3df5a432fd5b192162f03e277b9771acef Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 12 Dec 2016 15:51:56 -0500 Subject: [PATCH] Merge pull request #90 from DrewML/update-babel-warning Remove recommendation to change Babel preset from lib --- packages/rollup-plugin-babel/src/preflightCheck.js | 2 +- packages/rollup-plugin-babel/test/test.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/rollup-plugin-babel/src/preflightCheck.js b/packages/rollup-plugin-babel/src/preflightCheck.js index 6ae87d4ff..2a0413cd6 100644 --- a/packages/rollup-plugin-babel/src/preflightCheck.js +++ b/packages/rollup-plugin-babel/src/preflightCheck.js @@ -17,7 +17,7 @@ export default function preflightCheck ( options, dir ) { const check = transform( 'export default class Foo {}', options ).code; - if ( !~check.indexOf( 'export default' ) && !~check.indexOf( 'export { Foo as default }' ) ) throw new Error( 'It looks like your Babel configuration specifies a module transformer. Please disable it. If you\'re using the "es2015" preset, consider using "es2015-rollup" instead. See https://github.com/rollup/rollup-plugin-babel#configuring-babel for more information' ); + if ( !~check.indexOf( 'export default' ) && !~check.indexOf( 'export { Foo as default }' ) ) throw new Error( 'It looks like your Babel configuration specifies a module transformer. Please disable it. See https://github.com/rollup/rollup-plugin-babel#configuring-babel for more information' ); if ( ~check.indexOf( 'import _classCallCheck from "babel-runtime' ) ) helpers = RUNTIME; else if ( ~check.indexOf( 'function _classCallCheck' ) ) helpers = INLINE; diff --git a/packages/rollup-plugin-babel/test/test.js b/packages/rollup-plugin-babel/test/test.js index 343ae4fcd..489d85df5 100644 --- a/packages/rollup-plugin-babel/test/test.js +++ b/packages/rollup-plugin-babel/test/test.js @@ -140,7 +140,7 @@ describe( 'rollup-plugin-babel', function () { assert.ok( false, 'promise should not fulfil' ); }) .catch( function ( err ) { - assert.ok( /es2015-rollup/.test( err.message ), 'Expected an error about external helpers or module transform, got "' + err.message + '"' ); + assert.ok( /configuring-babel/.test( err.message ), 'Expected an error about external helpers or module transform, got "' + err.message + '"' ); }); }); @@ -149,7 +149,7 @@ describe( 'rollup-plugin-babel', function () { entry: 'samples/runtime-helpers/main.js', plugins: [ babelPlugin({ runtimeHelpers: true }) ], onwarn: function ( msg ) { - assert.equal( msg, `Treating 'babel-runtime/helpers/classCallCheck' as external dependency` ); + assert.equal( msg, 'Treating \'babel-runtime/helpers/classCallCheck\' as external dependency' ); } }).then( function ( bundle ) { var cjs = bundle.generate({ format: 'cjs' }).code; @@ -162,7 +162,7 @@ describe( 'rollup-plugin-babel', function () { entry: 'samples/named-function-helper/main.js', plugins: [ babelPlugin() ], onwarn: function ( msg ) { - assert.equal( msg, `Treating 'babel-runtime/helpers/classCallCheck' as external dependency` ); + assert.equal( msg, 'Treating \'babel-runtime/helpers/classCallCheck\' as external dependency' ); } }).then( function ( bundle ) { var cjs = bundle.generate({ format: 'cjs' }).code; @@ -187,7 +187,7 @@ describe( 'rollup-plugin-babel', function () { }).then( () => { console.warn = consoleWarn; assert.deepEqual( messages, [ - `The 'classCallCheck' Babel helper is used more than once in your code. It's strongly recommended that you use the "external-helpers" plugin or the "es2015-rollup" preset. See https://github.com/rollup/rollup-plugin-babel#configuring-babel for more information` + 'The \'classCallCheck\' Babel helper is used more than once in your code. It\'s strongly recommended that you use the "external-helpers" plugin or the "es2015-rollup" preset. See https://github.com/rollup/rollup-plugin-babel#configuring-babel for more information' ]); }); });