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

Commit

Permalink
works with transform-decorators-legacy (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Dec 29, 2015
1 parent a1ece89 commit dc4c62c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"rollup-pluginutils": "^1.1.0"
},
"devDependencies": {
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-es2015": "^6.1.18",
"babel-preset-es2015-rollup": "^1.0.0",
"babel-register": "^6.3.13",
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createFilter } from 'rollup-pluginutils';
function preflightCheck ( localOpts ) {
var check = transform( 'export default class Foo {}', localOpts ).code;
if ( ~check.indexOf( 'function _classCallCheck' ) ) throw new Error( 'External helpers are not enabled. Please add the "external-helpers-2" plugin or use the "es2015-rollup" preset. See https://github.com/rollup/rollup-plugin-babel#TK for more information' );
if ( !~check.indexOf( 'export 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#TK 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. If you\'re using the "es2015" preset, consider using "es2015-rollup" instead. See https://github.com/rollup/rollup-plugin-babel#TK for more information' );
}

function assign ( target, source ) {
Expand Down
4 changes: 4 additions & 0 deletions test/samples/transform-decorators-legacy/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": [ "es2015-rollup" ],
"plugins": [ "transform-decorators-legacy" ]
}
1 change: 1 addition & 0 deletions test/samples/transform-decorators-legacy/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default 42;
7 changes: 7 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ describe( 'rollup-plugin-babel', function () {
});
});

it( 'works with transform-decorators-legacy (#18)', function () {
return rollup.rollup({
entry: 'samples/transform-decorators-legacy/main.js',
plugins: [ babelPlugin() ]
});
});

it( 'checks config per-file', function () {
return rollup.rollup({
entry: 'samples/checks/main.js',
Expand Down

0 comments on commit dc4c62c

Please sign in to comment.