Skip to content

Conversation

@aryanjassal
Copy link
Contributor

@aryanjassal aryanjassal commented Apr 28, 2025

Description

Currently, yao-pkg does not work well with ESM packages. Thus, to solve this issue, we first have to compile the application in CJS mode instead, then include the native modules.

First, we need to make sure the native modules are being bundled correctly in the binary, then we need to fix up the paths, as many libraries use __dirname to refer to the current dir, which when compiled, points to the incorrect directory.

Issues Fixed

Tasks

  • 1. Compile to CJS via esbuild
  • 2. Confirm the bundle has native modules
  • 3. Fix up the import paths

Final checklist

  • Domain specific tests
  • Full tests
  • Updated inline-comment documentation
  • Lint fixed
  • Squash and rebased
  • Sanity check the final build

@aryanjassal aryanjassal self-assigned this Apr 28, 2025
@linear
Copy link

linear bot commented Apr 28, 2025

ENG-584

@aryanjassal aryanjassal requested a review from tegefaulkes April 28, 2025 04:34
@tegefaulkes tegefaulkes force-pushed the feature-esm-pkg-fix branch from d0bc480 to 5e46482 Compare April 29, 2025 05:18
@tegefaulkes tegefaulkes merged commit 1275816 into staging Apr 29, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Fix ESM pkg packaged output

4 participants