* Resolves a filepath using the same logic as the rest of our build pipeline (babel module-resolver). * The return value is a relative path from the amphtml folder. * * @param {string} filepath * @param {'preact' | 'react' | null} buildFor * @return {string}
(filepath, buildFor = 'preact')
| 110 | * @return {string} |
| 111 | */ |
| 112 | function resolvePath(filepath, buildFor = 'preact') { |
| 113 | // 2nd arg is a file from which to make a relative path. |
| 114 | // The actual file doesn't need to exist. In this case it is process.cwd()/anything |
| 115 | return moduleResolver.resolvePath( |
| 116 | filepath, |
| 117 | 'anything', |
| 118 | getImportResolver(buildFor) |
| 119 | ); |
| 120 | } |
| 121 | |
| 122 | module.exports = { |
| 123 | getImportResolver, |
no test coverage detected