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
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
exportDefaultFrom
and im thinking it can be this but it cannot be combined with
"syntax": "typescript"
"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?