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

node-expat cannot be imported in worker threads #203

Open
achille-roussel opened this issue Mar 10, 2020 · 0 comments
Open

node-expat cannot be imported in worker threads #203

achille-roussel opened this issue Mar 10, 2020 · 0 comments

Comments

@achille-roussel
Copy link

achille-roussel commented Mar 10, 2020

Hello,

I encountered an issue trying to load node-expat in the context of a worker thread, see the minimal reproduction below:

{
  "name": "node-expat-bug",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "node-expat": "^2.3.18"
  }
}
const { Worker, isMainThread } = require('worker_threads')

if (isMainThread) {
  // Require in the top-level context works fine.
  require('node-expat')
  worker = new Worker(__filename)
} else {
  // Require in the context of a worker thread throws an exception:
  //
  //    Error: Module did not self-register: ...
  //
  require('node-expat')
}

This may be an example of how to fix it schroffl/node-lzo#11

Does this module aim to be usable in the context of a worker threads?

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

Successfully merging a pull request may close this issue.

1 participant