mirror of https://github.com/lukechilds/rollup.git
Rich-Harris
9 years ago
5 changed files with 30 additions and 5 deletions
@ -0,0 +1,14 @@ |
|||
var path = require( 'path' ); |
|||
|
|||
module.exports = { |
|||
description: 'non .js extensions are preserved', |
|||
options: { |
|||
plugins: [{ |
|||
transform: function ( code, id ) { |
|||
if ( path.extname( id ) === '.json' ) { |
|||
return 'export default ' + code; |
|||
} |
|||
} |
|||
}] |
|||
} |
|||
}; |
@ -0,0 +1,3 @@ |
|||
{ |
|||
"answer": 42 |
|||
} |
@ -0,0 +1,3 @@ |
|||
import info from './info.json'; |
|||
|
|||
assert.equal( info.answer, 42 ); |
Loading…
Reference in new issue