fix(esm): add tsc alias

This commit is contained in:
Mauricio Siu 2024-09-29 21:43:25 -06:00
parent bd243d79e2
commit e99666f4c0
4 changed files with 37 additions and 26 deletions

View File

@ -1,25 +1,27 @@
// import esbuild from "esbuild"; import { build } from "esbuild";
import TsconfigPathsPlugin from "@esbuild-plugins/tsconfig-paths";
import path from "node:path";
// try { build({
// esbuild entryPoints: ["./src/**/*.ts", "./src/**/*.tsx"], // Punto de entrada principal de tu aplicación
// .build({ outdir: "dist",
// entryPoints: ["./src/**/*.ts"], bundle: false, // Cambia a true si deseas bundlear tu código
// bundle: true, platform: "node",
// platform: "node", format: "esm",
// format: "cjs", target: ["esnext"],
// target: "node18", sourcemap: false,
// outExtension: { ".js": ".js" }, tsconfig: "./tsconfig.server.json",
// minify: true, plugins: [
// outdir: "dist", // TsconfigPathsPlugin({ tsconfig: "./tsconfig.server.json" }),
// tsconfig: "tsconfig.server.json", {
// packages: "external", name: "AddJsExtensions",
// alias: { setup(build) {
// "@/server": "./src", build.onResolve({ filter: /.*/ }, (args) => {
// }, if (args.path.startsWith(".") && !path.extname(args.path)) {
// }) return { path: `${args.path}.js` };
// .catch(() => { }
// return process.exit(1); });
// }); },
// } catch (error) { },
// console.log(error); ],
// } }).catch(() => process.exit(1));

View File

@ -7,7 +7,7 @@
"scripts": { "scripts": {
"dev": "tsup --config ./tsup.ts --watch", "dev": "tsup --config ./tsup.ts --watch",
"build": "tsc --project tsconfig.server.json && tsc-alias -p tsconfig.server.json", "build": "tsc --project tsconfig.server.json && tsc-alias -p tsconfig.server.json",
"tsc": "tsc --project tsconfig.server.json", "esbuild": "tsx ./esbuild.config.ts",
"build:types": "tsc --emitDeclarationOnly --experimenta-dts" "build:types": "tsc --emitDeclarationOnly --experimenta-dts"
}, },
"dependencies": { "dependencies": {
@ -48,6 +48,7 @@
"ssh2": "1.15.0" "ssh2": "1.15.0"
}, },
"devDependencies": { "devDependencies": {
"tsx": "^4.7.1",
"tsc-alias": "1.8.10", "tsc-alias": "1.8.10",
"@types/adm-zip": "^0.5.5", "@types/adm-zip": "^0.5.5",
"@types/bcrypt": "5.0.2", "@types/bcrypt": "5.0.2",

View File

@ -10,10 +10,15 @@
"moduleResolution": "Node", "moduleResolution": "Node",
"baseUrl": ".", "baseUrl": ".",
"incremental": false, "incremental": false,
"jsx": "react-jsx",
"paths": { "paths": {
"@/server/*": ["src/*"] "@/server/*": ["src/*"]
} }
}, },
"include": ["next-env.d.ts", "./src/**/*"], "include": ["next-env.d.ts", "./src/**/*"],
"exclude": ["**/dist", "tsup.ts"] "exclude": ["**/dist", "tsup.ts"],
"tsc-alias": {
"resolveFullPaths": true,
"verbose": false
}
} }

View File

@ -695,6 +695,9 @@ importers:
tsup: tsup:
specifier: 6.4.0 specifier: 6.4.0
version: 6.4.0(postcss@8.4.40)(typescript@5.5.3) version: 6.4.0(postcss@8.4.40)(typescript@5.5.3)
tsx:
specifier: ^4.7.1
version: 4.16.2
typescript: typescript:
specifier: ^5.4.2 specifier: ^5.4.2
version: 5.5.3 version: 5.5.3