mirror of https://github.com/lukechilds/rollup.git
8 changed files with 50 additions and 2 deletions
@ -0,0 +1,15 @@ |
|||||
|
module.exports = { |
||||
|
description: 'method of external named import used inside prototype method (#68)', |
||||
|
context: { |
||||
|
// override require here, making "foo" appear as a global module
|
||||
|
require: function ( name ) { |
||||
|
if ( name === 'bar' ) { |
||||
|
return require( './bar' ); |
||||
|
} |
||||
|
return require( name ); |
||||
|
} |
||||
|
}, |
||||
|
options: { |
||||
|
external: [ 'bar' ] |
||||
|
} |
||||
|
}; |
@ -0,0 +1,5 @@ |
|||||
|
exports.bar = { |
||||
|
foobar: function () { |
||||
|
return 42; |
||||
|
} |
||||
|
}; |
@ -0,0 +1,9 @@ |
|||||
|
import { bar } from 'bar'; |
||||
|
|
||||
|
export default function Foo() { |
||||
|
this.answer = bar.foobar(); |
||||
|
} |
||||
|
|
||||
|
Foo.prototype.bar = function () { |
||||
|
return bar.foobar(); |
||||
|
}; |
@ -0,0 +1,3 @@ |
|||||
|
import Foo from './foo.js'; |
||||
|
|
||||
|
assert.equal( new Foo().bar(), 42 ); |
Loading…
Reference in new issue