Open aelbore opened 4 years ago
Hi,
Sorry for not responding for so long. What about using @rollup/plugin-node-resolve
like in the example?
didn't wanna open up a new issue... so i'm hijacking this as it's SOMEWHAT related.
I can't build, because imports are missing the *.ts extension, which Typescript omits by default. I'd like to keep it that way. How can i make SWC resolve those imports correctly? Or do i have to add the extension to every import now?
If i add extensions: ['.ts'],
to the nodeResolve plugin like in the example, it can't resolve node_modules imports. Tries to resolve "repeat.ts" instead of "repeat.js" as in the actual import.
@abenz1267, have you tried extensions: ['.js', '.ts']
?
Oh yeah, i did.
Error: Could not load /home/andrej/Documents/litdo/node_modules/lit/directives/repeat.ts (imported by src/index.ts): ENOENT: no such file or directory, open '/home/andrej/Documents/litdo/node_modules/lit/directives/repeat.ts'
Is the whole error. Keep in mind the actual import calls repeat.js
not repeat.ts
.
On 14 Jul 2021, 13:28 +0200, Petr Tsymbarovich @.***>, wrote:
@abenz1267, have you tried extensions: ['.js', '.ts']? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Any update on this? Ideally, it should not require @rollup/plugin-node-resolve
for relative files.
Related: even using @rollup/plugin-node-resolve
, I couldn't get this plugin / SWC to resolve index files, like: ./src/ui/Button/index.ts
when using
import { Button } from '@ui/Button'
Is this a SWC issue, and regardless, is there a way to get SWC to resolve paths using other rollup plugins? It doesn't seem like module resolution in SWC uses the Rollup flow to resolve paths.
Please see PR #3