Browse Source

Merge pull request #886 from rollup/import-rollup-in-cli

replace require kludge in runRollup.js
rewrite
Rich Harris 8 years ago
committed by GitHub
parent
commit
0d5d156723
  1. 7
      bin/src/runRollup.js
  2. 10
      rollup.config.cli.js

7
bin/src/runRollup.js

@ -1,10 +1,9 @@
import { realpathSync } from 'fs'; import { realpathSync } from 'fs';
import { rollup } from 'rollup';
import relative from 'require-relative'; import relative from 'require-relative';
import handleError from './handleError'; import handleError from './handleError';
import SOURCEMAPPING_URL from './sourceMappingUrl.js'; 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'; import { install as installSourcemapSupport } from 'source-map-support';
installSourcemapSupport(); installSourcemapSupport();
@ -58,7 +57,7 @@ export default function runRollup ( command ) {
config = realpathSync( config ); config = realpathSync( config );
} }
rollup.rollup({ rollup({
entry: config, entry: config,
onwarn: message => { onwarn: message => {
if ( /Treating .+ as external dependency/.test( message ) ) return; if ( /Treating .+ as external dependency/.test( message ) ) return;
@ -217,7 +216,7 @@ function bundle ( options ) {
handleError({ code: 'MISSING_INPUT_OPTION' }); handleError({ code: 'MISSING_INPUT_OPTION' });
} }
return rollup.rollup( options ).then( bundle => { return rollup( options ).then( bundle => {
if ( options.dest ) { if ( options.dest ) {
return bundle.write( options ); return bundle.write( options );
} }

10
rollup.config.cli.js

@ -15,7 +15,7 @@ export default {
buble(), buble(),
commonjs({ commonjs({
include: 'node_modules/**', include: 'node_modules/**',
namedExports: { 'chalk': [ 'red', 'cyan', 'grey' ] } namedExports: { chalk: [ 'red', 'cyan', 'grey' ] }
}), }),
nodeResolve({ nodeResolve({
main: true main: true
@ -25,6 +25,10 @@ export default {
'fs', 'fs',
'path', 'path',
'module', 'module',
'source-map-support' 'source-map-support',
] 'rollup'
],
paths: {
rollup: '../dist/rollup.js'
}
}; };

Loading…
Cancel
Save