Browse Source

handle scoped packages

contingency-plan
Rich Harris 9 years ago
parent
commit
abbc9f9ea5
  1. 6
      src/utils/resolveId.js

6
src/utils/resolveId.js

@ -38,6 +38,12 @@ export function defaultExternalResolver ( id, importer ) {
// `foo` should use jsnext:main, but `foo/src/bar` shouldn't
const parts = id.split( /[\/\\]/ );
// npm scoped packages – @user/package
if ( parts[0][0] === '@' && parts[1] ) {
var user = parts.shift();
parts[0] = user + '/' + parts[0];
}
while ( dir !== root && dir !== '.' ) {
const modulePath = resolve( dir, 'node_modules', parts[0] );

Loading…
Cancel
Save