Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg.js fails to include tslib dependency #387

Closed
tegefaulkes opened this issue Jun 23, 2022 · 1 comment
Closed

pkg.js fails to include tslib dependency #387

tegefaulkes opened this issue Jun 23, 2022 · 1 comment
Labels
development Standard development

Comments

@tegefaulkes
Copy link
Contributor

Specification

pkg is failing to properly include the tslib dependency. This is needed by async-locks and cheerio as a dependency.

The problem seems to be that pkg is adding the tslib files to the queue during the walker phase but only as the bytecode. during the packing phase when it attempts to add the required files it skips them due to our use of the --no-bytecode flag. Thus throwing the following error.

> Error! --no-bytecode and no source breaks final executable
  /home/faulkes/matrixcode/polykey/js-polykey/node_modules/tslib/tslib.js
  Please run with "-d" and without "--no-bytecode" first, and make
  sure that debug log does not contain "was included as bytecode".

We suspect this may be due to pkg not properly parsing es6 modules. Discussion about this can be found starting from here

Currently a stopgap fix is to force include tslib by adding the files as an asset to the pkg config in package.json.

  "pkg": {
    "assets": [
      "node_modules/tslib/**/*.js",
      ...
    ],
  },

Additional context

Tasks

  1. determine a better fix if any.
  2. use a bundler to circumvent the problem.
@CMCDragonkai
Copy link
Member

CMCDragonkai commented Jun 28, 2022

You've fixed this by adding tslib directly into the pkg configuration in #379. We're going to side-step this issue by solving the root of the problem in MatrixAI/Polykey-CLI#23 by using a purpose-built bundler first, then using pkg only for the last step of combining it virtual filesystem for non-js assets, and native addons as well as the node executable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Standard development
Development

No branches or pull requests

2 participants