From 27c068874265a1a0ad47c52ad5332c2bf1593d8b Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Tue, 28 Jul 2015 01:21:23 +0100 Subject: [PATCH] check if options are nully instead of falsy - fixes #2079 --- packages/babel/src/transformation/modules/_default.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/babel/src/transformation/modules/_default.js b/packages/babel/src/transformation/modules/_default.js index 48c9af8331..940e10e3ef 100644 --- a/packages/babel/src/transformation/modules/_default.js +++ b/packages/babel/src/transformation/modules/_default.js @@ -333,14 +333,14 @@ export default class DefaultFormatter { getModuleName() { var opts = this.file.opts; // moduleId is n/a if a `getModuleId()` is provided - if (opts.moduleId && !opts.getModuleId) { + if (opts.moduleId != null && !opts.getModuleId) { return opts.moduleId; } var filenameRelative = opts.filenameRelative; var moduleName = ""; - if (opts.moduleRoot) { + if (opts.moduleRoot != null) { moduleName = opts.moduleRoot + "/"; } @@ -348,7 +348,7 @@ export default class DefaultFormatter { return moduleName + opts.filename.replace(/^\//, ""); } - if (opts.sourceRoot) { + if (opts.sourceRoot != null) { // remove sourceRoot from filename var sourceRootRegEx = new RegExp("^" + opts.sourceRoot + "\/?"); filenameRelative = filenameRelative.replace(sourceRootRegEx, "");