use path basename as non-default import fallback - fixes #1207

This commit is contained in:
Sebastian McKenzie
2015-04-09 14:36:00 -07:00
parent 1a9f193841
commit 704b31f44f
5 changed files with 22 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
import DefaultFormatter from "./_default";
import AMDFormatter from "./amd";
import values from "lodash/object/values";
import path from "path";
import * as util from "../../util";
import * as t from "../../types";
@@ -51,7 +52,7 @@ export default class UMDFormatter extends AMDFormatter {
if (this.passModuleArg) browserArgs.push(t.identifier("mod"));
for (let name in this.ids) {
var id = this.defaultIds[name] || t.identifier(t.toIdentifier(name));
var id = this.defaultIds[name] || t.identifier(t.toIdentifier(path.basename(name, path.extname(name))));
browserArgs.push(t.memberExpression(t.identifier("global"), id));
}