From 3817b74002b66f901bdf3cce64eff9bafc7dc1c7 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Mon, 29 Aug 2016 20:01:39 -0400 Subject: [PATCH] replace require kludge in runRollup.js (#706 - comment) --- bin/src/runRollup.js | 7 +++---- rollup.config.cli.js | 10 +++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/bin/src/runRollup.js b/bin/src/runRollup.js index 270654f..70e028e 100644 --- a/bin/src/runRollup.js +++ b/bin/src/runRollup.js @@ -1,10 +1,9 @@ import { realpathSync } from 'fs'; +import { rollup } from 'rollup'; import relative from 'require-relative'; import handleError from './handleError'; import SOURCEMAPPING_URL from './sourceMappingUrl.js'; -const rollup = require( '../dist/rollup.js' ); // TODO make this an import, somehow - import { install as installSourcemapSupport } from 'source-map-support'; installSourcemapSupport(); @@ -58,7 +57,7 @@ export default function runRollup ( command ) { config = realpathSync( config ); } - rollup.rollup({ + rollup({ entry: config, onwarn: message => { if ( /Treating .+ as external dependency/.test( message ) ) return; @@ -217,7 +216,7 @@ function bundle ( options ) { handleError({ code: 'MISSING_INPUT_OPTION' }); } - return rollup.rollup( options ).then( bundle => { + return rollup( options ).then( bundle => { if ( options.dest ) { return bundle.write( options ); } diff --git a/rollup.config.cli.js b/rollup.config.cli.js index 95e8588..982f6b0 100644 --- a/rollup.config.cli.js +++ b/rollup.config.cli.js @@ -15,7 +15,7 @@ export default { buble(), commonjs({ include: 'node_modules/**', - namedExports: { 'chalk': [ 'red', 'cyan', 'grey' ] } + namedExports: { chalk: [ 'red', 'cyan', 'grey' ] } }), nodeResolve({ main: true @@ -25,6 +25,10 @@ export default { 'fs', 'path', 'module', - 'source-map-support' - ] + 'source-map-support', + 'rollup' + ], + paths: { + rollup: '../dist/rollup.js' + } };