Skip to content

Commit

Permalink
Merge branch 'fix-js-generator' of github.com:feathersjs/feathers int…
Browse files Browse the repository at this point in the history
…o update-dependencies-9865058591
  • Loading branch information
daffl committed Jul 10, 2024
2 parents daf6cb5 + 3d6b7de commit d47d8e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/generators/src/commons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ export const getJavaScript = (typescript: string, options: ts.TranspileOptions =
...options.compilerOptions
}
})
const { outputText } = transpiled

if (outputText.startsWith('export {}') && typescript.startsWith('import')) {
return fixLocalImports(typescript)
}

return fixLocalImports(restoreNewLines(transpiled.outputText))
}
Expand Down
5 changes: 5 additions & 0 deletions packages/generators/test/commons.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,10 @@ import something from './file.js';
const otherThing = "Hello";
`
)

strictEqual(
getJavaScript(`import { authentication } from './authentication'`),
`import { authentication } from './authentication.js'`
)
})
})

0 comments on commit d47d8e9

Please sign in to comment.