Skip to content

Commit

Permalink
Merge pull request #10 from ssutar/master
Browse files Browse the repository at this point in the history
Resolve the source file name while constructing define alias
  • Loading branch information
rwjblue authored Dec 18, 2018
2 parents 28e4396 + 4ed7ac6 commit 7fd4bb9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const path = require('path');
const amdNameResolver = require('amd-name-resolver');

// Check if a given Program is only a re-export statement
function isReExportOnly(program) {
Expand Down Expand Up @@ -87,7 +88,8 @@ function CompactReexports(babel) {
if (state.reexport) {
const source = state.reexport.source;
const alias = this.getModuleName();
const newProgram = t.program( [ constructDefineAlias(t, source, alias) ] );
const resolvedSource = amdNameResolver.moduleResolve(source, alias);
const newProgram = t.program( [ constructDefineAlias(t, resolvedSource, alias) ] );

path.replaceWith(newProgram);
path.stop();
Expand Down

0 comments on commit 7fd4bb9

Please sign in to comment.