use path basename as non-default import fallback - fixes #1207
This commit is contained in:
parent
1a9f193841
commit
704b31f44f
@ -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));
|
||||
}
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(mod.exports, global.foo, global.fooBar, global.directoryFooBar);
|
||||
factory(mod.exports, global.foo, global.fooBar, global.fooBar);
|
||||
global.actual = mod.exports;
|
||||
}
|
||||
})(this, function (exports, _foo, _fooBar, _directoryFooBar) {
|
||||
|
||||
@ -0,0 +1 @@
|
||||
import { render } from "./lib/render";
|
||||
@ -0,0 +1,15 @@
|
||||
(function (global, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "./lib/render"], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports, require("./lib/render"));
|
||||
} else {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(mod.exports, global.render);
|
||||
global.actual = mod.exports;
|
||||
}
|
||||
})(this, function (exports, _libRender) {
|
||||
"use strict";
|
||||
});
|
||||
@ -7,7 +7,7 @@
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(mod.exports, global.foo2, global.fooBar, global.directoryFooBar);
|
||||
factory(mod.exports, global.foo2, global.fooBar, global.fooBar);
|
||||
global.actual = mod.exports;
|
||||
}
|
||||
})(this, function (exports, _foo, _fooBar, _directoryFooBar) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user