mirror of https://github.com/lukechilds/rollup.git
Mickael Jeanroy
9 years ago
4 changed files with 52 additions and 2 deletions
@ -0,0 +1,28 @@ |
|||
var assert = require( 'assert' ); |
|||
var path = require( 'path' ); |
|||
|
|||
module.exports = { |
|||
description: 'includes an external module included dynamically by an alias', |
|||
options: { |
|||
entry: path.join( __dirname, 'first', 'main.js' ), |
|||
external: [ 'lodash' ], |
|||
|
|||
// Define a simple alias plugin for underscore
|
|||
plugins: [ |
|||
{ |
|||
resolveId: function ( id ) { |
|||
if ( id === 'underscore' ) { |
|||
return 'lodash'; |
|||
} |
|||
} |
|||
} |
|||
] |
|||
}, |
|||
|
|||
context: { |
|||
require: function ( required ) { |
|||
assert.equal( required, 'lodash' ); |
|||
return 1; |
|||
} |
|||
} |
|||
}; |
@ -0,0 +1,10 @@ |
|||
import _ from 'underscore'; |
|||
import first from './module'; |
|||
|
|||
export default function ( inputs ) { |
|||
if ( !_.isArray( inputs ) ) { |
|||
return inputs; |
|||
} |
|||
|
|||
return first.square( inputs ); |
|||
}; |
@ -0,0 +1,7 @@ |
|||
import _ from 'underscore'; |
|||
|
|||
export default function square ( inputs ) { |
|||
return _.map( inputs, function ( x ) { |
|||
return x * x; |
|||
}); |
|||
}; |
Loading…
Reference in new issue