ankit / stylebot

Change the appearance of the web instantly
https://stylebot.dev/
MIT License
1.41k stars 208 forks source link

Remove `fibers` dependency #750

Closed rmacklin closed 4 months ago

rmacklin commented 1 year ago

It seems that the usage of this dependency was removed in https://github.com/ankit/stylebot/commit/b7d2708110efc2177e1ae2fd0312109194d92714#diff-1fb26bc12ac780c7ad7325730ed09fc4c2c3d757c276c3dacc44bfe20faf166fL62-L64, so we don't actually need it. Furthermore, even though it doesn't appear to be used anywhere else, just having the package as a dependency breaks yarn build on node 16:

yarn build
yarn run v1.22.19
$ cross-env NODE_ENV=production webpack --hide-modules
  build [===                 ] 15%Assertion failed: (thread_id_key != 0x7777), function find_thread_id_key, file coroutine.cc, line 134.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

RpcIpcMessagePortClosedError: Cannot send the message - the message port has been closed for the process 83355.
    at /Users/rmacklin/src/github.com/ankit/stylebot/stylebot/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:47:47
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: undefined,
  signal: undefined
}

and that thread_id_key error is apparently a well-known issue with the fibers package which doesn't support node 16: https://github.com/laverdet/node-fibers/commit/8f2809869cc92c28c92880c4a38317ae3dbe654d

After removing the dependency, we can successfully run yarn build on node 16 (which is important, because earlier versions of node are not supported on darwin-arm64, a.k.a. Apple Silicon):

yarn build
yarn run v1.22.19
$ cross-env NODE_ENV=production webpack --hide-modules
  build [======              ] 32%Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Build completed in 5.822s
rmacklin commented 6 months ago

@ankit Are you still maintaining this repo? If so, would you consider merging this PR? If not, would you be open to updating the README to indicate that you are no longer maintaining it?

ankit commented 4 months ago

@rmacklin yes, I am maintaining it every now and then. I will merge your PR, thank you

rmacklin commented 4 months ago

Awesome, thank you!!