Skip to content

Commit

Permalink
fix(ts-transform-plugin): commonjs module fix #1
Browse files Browse the repository at this point in the history
  • Loading branch information
zerkalica committed May 26, 2018
1 parent 1aa3762 commit f5aee9a
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions packages/ts-transform-paths/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,19 @@ function importPathVisitor(
fixNode.pos = cachedPos
fixNode.end = cachedPos + newStr.length

// const newSpec = ts.createLiteral(newImport)
const newSpec = ts.createLiteral(newImport)

// if (ts.isImportDeclaration(node)) return ts.updateImportDeclaration(
// node, undefined, undefined, undefined, newSpec
// )
if (ts.isImportDeclaration(node)) return ts.updateImportDeclaration(
node, undefined, undefined, undefined, newSpec
)

if (ts.isExportDeclaration(node)) return ts.updateExportDeclaration(
node, undefined, undefined, undefined, newSpec
)

// if (ts.isExportDeclaration(node)) return ts.updateExportDeclaration(
// node, undefined, undefined, undefined, newSpec
// )
if (ts.isCallExpression(node)) return ts.updateCall(
node, node.expression, undefined, [newSpec]
)
}

function patchEmitFiles(host: any): ts.TransformerFactory<ts.SourceFile>[] {
Expand Down

0 comments on commit f5aee9a

Please sign in to comment.