refactor: remove save on build on next app and integrate turbopack

This commit is contained in:
Mauricio Siu
2024-10-24 23:13:24 -06:00
parent cb586c9b74
commit 47aa223f87
93 changed files with 810 additions and 303 deletions

View File

@@ -0,0 +1,27 @@
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const packagePath = path.resolve(__dirname, "../package.json");
const pkg = JSON.parse(fs.readFileSync(packagePath, "utf-8"));
pkg.exports = {
".": {
import: "./dist/index.js",
require: "./dist/index.cjs.js",
},
"./db": {
import: "./dist/db/index.js",
require: "./dist/db/index.cjs.js",
},
"./*": {
import: "./dist/*",
require: "./dist/*.cjs",
},
};
fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2));
console.log("Switched exports to use dist for production");

View File

@@ -0,0 +1,24 @@
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const packagePath = path.resolve(__dirname, "../package.json");
// Leer el archivo package.json
const pkg = JSON.parse(fs.readFileSync(packagePath, "utf-8"));
// Modificar los exports
pkg.exports = {
".": "./src/index.ts",
"./db": {
import: "./src/db/index.ts",
require: "./dist/db/index.cjs.js",
},
};
// Guardar los cambios en package.json
fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2));
console.log("Switched exports to use src for development");