Treora commented on a change in pull request #117: URL: https://github.com/apache/incubator-annotator/pull/117#discussion_r744517548
########## File path: babel.config.js ########## @@ -47,14 +50,25 @@ module.exports = (api) => { // Options for the module-resolver plugin. // Used for resolving source files during development. const resolverOptions = { - alias: { - ...(DEV || TEST - ? { + ...(DEV || TEST + ? { + alias: { '^@apache-annotator/([^/]+)$': ([, name]) => - path.join(__dirname, 'packages', name, '/src/index.ts'), - } - : null), - }, + path.join(packagePath, name, '/src/index.ts'), + }, + resolvePath(sourcePath, currentFile, opts) { + if ( + currentFile.startsWith(packagePath) && + currentFile.endsWith('.ts') && + sourcePath.startsWith('.') && + sourcePath.endsWith('.js') + ) { + return sourcePath.replace(/\.js$/, '.ts'); + } + return resolvePath(sourcePath, currentFile, opts); + }, Review comment: Unfortunate we’d need a custom resolver for this, but so be it. I wonder why TypeScript does not simply accept an `import '….ts';` statement, and would transpile it to the equivalent `.js` import. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@annotator.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org