diff --git a/lib/babel/transformation/file.js b/lib/babel/transformation/file.js index 758a658fd3..6d0ea188a1 100644 --- a/lib/babel/transformation/file.js +++ b/lib/babel/transformation/file.js @@ -86,10 +86,12 @@ File.validOptions = [ "format", "playground", "experimental", - "resolveModuleSource", "externalHelpers", "auxiliaryComment", + "resolveModuleSource", + "getModuleName", + // these are used by plugins "ignore", "only", diff --git a/lib/babel/transformation/modules/_default.js b/lib/babel/transformation/modules/_default.js index 93353752cd..0e80537bdf 100644 --- a/lib/babel/transformation/modules/_default.js +++ b/lib/babel/transformation/modules/_default.js @@ -146,6 +146,8 @@ DefaultFormatter.prototype.isLocalReference = function (node, scope) { DefaultFormatter.prototype.getModuleName = function () { var opts = this.file.opts; + if (opts.getModuleName) return opts.getModuleName(opts.filename); + var filenameRelative = opts.filenameRelative; var moduleName = "";