I'm using swc to build a project that works with modules ```json { // ... "type": "module" // ... } ``` when I build using the swc cli it doesn't resolve all the paths and puts .js at the end examples ```ts import { database } from '#/database/drizzle' ``` should look like this when the build is complete ```js import { database } from './database/drizzle.js' ``` There should be an option to resolve fullpaths like this package implements. Using this package you can use an argument that resolves all paths https://www.npmjs.com/package/tsc-alias ```json // ... "tsc-alias": { "resolveFullPaths": true } /// .... ```
Activity
luas10c commentedon Oct 12, 2024
I need to do it this way to solve the problem.
.swcrc
{ "$schema": "https://swc.rs/schema.json", "jsc": { "baseUrl": ".", "parser": { "syntax": "typescript" }, "target": "es2020", "paths": { "#/*": ["./src/*"] } }, "module": { "type": "es6", "strict": true } }tsconfig.json
{ "compilerOptions": { "strict": true, "skipLibCheck": true, "esModuleInterop": true, "target": "es2022", "module": "es2020", "moduleResolution": "node", "outDir": "dist", "allowSyntheticDefaultImports": true, "paths": { "#/*": ["./src/*"] } }, "tsc-alias": { "resolveFullPaths": true } }Redesign (#60)
Redesign (#60)