Skip to content

Commit

Permalink
fix(workspace-tools): Added troubleshooting logging to tsup build
Browse files Browse the repository at this point in the history
  • Loading branch information
sullivanpj committed Nov 16, 2023
1 parent f163381 commit f033bc5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
1 change: 0 additions & 1 deletion packages/workspace-tools/src/executors/tsup/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ export default async function runExecutor(

console.log("Getting Tsup build config");

process.env["TSUP_PACKAGE_JSON_PATH"] = packageJsonPath;
const config = getConfig(sourceRoot, { ...options, outputPath });
if (typeof config === "function") {
await build(await Promise.resolve(config({})));
Expand Down
12 changes: 9 additions & 3 deletions patches/tsup@7.2.0.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/dist/index.js b/dist/index.js
index 68c197cb2b8dfa928a448475b4020e7301da959e..9db825945878f8cd724486c0b2b73871385e7d12 100644
index 68c197cb2b8dfa928a448475b4020e7301da959e..426559111d4475c7e4fecc69217d037e9ff0c516 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1605,8 +1605,24 @@ async function runEsbuild(options, {
@@ -1605,8 +1605,30 @@ async function runEsbuild(options, {
buildDependencies,
pluginContainer
}) {
Expand All @@ -11,25 +11,31 @@ index 68c197cb2b8dfa928a448475b4020e7301da959e..9db825945878f8cd724486c0b2b73871
+ let pkgPath = options.outDir
+ ? options.outDir
+ : process.cwd();
+ console.error("Original pkgPath: ", pkgPath);
+ if (pkgPath) {
+ const splits = pkgPath.split(_path2.default.sep);
+ console.error("splits: ", splits);
+ if (splits.length > 0) {
+ const pkgPathIndex = splits.slice(0, splits.length)
+ .findLastIndex(index =>
+ existsSync(_path2.default.join(splits.slice(0, index)
+ .join(_path2.default.sep), "package.json")));
+ console.error("pkgPathIndex: ", pkgPathIndex);
+ if (pkgPathIndex) {
+ pkgPath = splits.slice(0, pkgPathIndex).join(_path2.default.sep);
+ console.error("Updated pkgPath: ", pkgPath);
+ }
+ }
+ }
+
+ console.error("Final pkgPath: ", pkgPath);
+ const pkg = await _chunk52KWB5QBjs.loadPkg.call(void 0, pkgPath);
+ console.error("pkg: ", pkg);
+ const deps = await _chunk52KWB5QBjs.getProductionDeps.call(void 0, pkgPath);
const external = [
// Exclude dependencies, e.g. `lodash`, `lodash/get`
...deps.map((dep) => new RegExp(`^${dep}($|\\/|\\\\)`)),
@@ -2052,6 +2068,7 @@ var sizeReporter = () => {
@@ -2052,6 +2074,7 @@ var sizeReporter = () => {
// src/plugins/tree-shaking.ts
var import_rollup_plugin_hashbang = _chunkB7UJSB4Njs.__toESM.call(void 0, _chunk52KWB5QBjs.require_dist.call(void 0, ));
var _rollup = require('rollup');
Expand Down
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f033bc5

Please sign in to comment.