Browse Source

Merge pull request #13 from rollup/allow-extensions

Use `extname` function to detect if we should append '.js'
blurb
Rich Harris 9 years ago
parent
commit
a34a25378f
  1. 8
      src/app/BaseView.html

8
src/app/BaseView.html

@ -41,7 +41,7 @@
</style>
<script>
import { dirname, resolve } from './utils/path';
import { dirname, resolve, extname } from './utils/path';
import tap from 'ractive-events-tap';
component.exports = {
@ -114,7 +114,11 @@
if ( id === '@main' ) return modules[0].code;
if ( id.substr( 0, 2 ) === './' ) id = id.substring( 2 );
const module = moduleById[ id + '.js' ];
if ( extname( id ) === '' ) {
id += '.js';
}
const module = moduleById[ id ];
if ( !module ) throw new Error( `missing module ${id}` ); // TODO...

Loading…
Cancel
Save