πŸ“¦ERR_UNSUPPORTED_DIR_IMPORT - ES modules

Hello! Im not sure there is place for help in SWC configure , but i will try because i cant find help (Im gonna remove that if it will be problem). Last time i have problem with error ERR_UNSUPPORTED_DIR_IMPORT which is throwing after launching compiled file with SWC. I wanted to do cli node app which will use dir imports like that:
// utils is directory with files (functions) and everyone of them are exported at index.ts which is 'default' file of directory
βœ…
import {func1,func2,func3} from "utils"
import func4 from "func4File"
❌
import {func1,func2,func3} from "utils/index.js"
import func4 from "func4File.js"

❌
import {func1,func2,func3} from "utils/index.ts"
import func4 from "func4File.ts"
// utils is directory with files (functions) and everyone of them are exported at index.ts which is 'default' file of directory
βœ…
import {func1,func2,func3} from "utils"
import func4 from "func4File"
❌
import {func1,func2,func3} from "utils/index.js"
import func4 from "func4File.js"

❌
import {func1,func2,func3} from "utils/index.ts"
import func4 from "func4File.ts"
I used it many times at nextjs projects and i basically thought it was typescript compiler fixing but i was wrong (I was learning Ts induring next) My first thought it was problem it's with Typescript compiler and i asked on they DC but someone told me problem it's because it's standard ES modules requirement and that was working before because Bundler like SWC was fixing that issues (next js have many plugins) I was reading SWC Docs, i notice in config exportDefaultFrom and im thinking it can be this but it cannot be combined with "syntax": "typescript" So, my questions are: - It's possible to do it like i want? I - How can i do that? There is option/plugin for this or something? - Should i try to use other builder? REPO https://github.com/INeedJobToStartWork/helpme (Problem it's with /bin, not nextjs app)
GitHub
GitHub - INeedJobToStartWork/helpme
Contribute to INeedJobToStartWork/helpme development by creating an account on GitHub.
1 Reply
-?-?-?-?-?-?-?-?-?-?-
-?-?-?-?-?-?-?-?-?-?-β€’11mo ago
Update As i see, SWC is bundler, but is more like for bundler like unstyled components library for UI Components library - Thing on which can be builded more expanded bundlers like Webpack whose can use SWC for some task, Anyway i need help to decide which Bundler can do that and i should (in your opinion) pick.
Want results from more Discord servers?
Add your server