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

new build 0.10.0 version is not working inside web workers #818

Open
ChaosEngine opened this issue Sep 7, 2020 · 4 comments · May be fixed by #819
Open

new build 0.10.0 version is not working inside web workers #818

ChaosEngine opened this issue Sep 7, 2020 · 4 comments · May be fixed by #819

Comments

@ChaosEngine
Copy link

ChaosEngine commented Sep 7, 2020

Probably due to new webpack default settings outputglobalobject which is window we are seeing this generated inside forge.all.min.,js and forge.min.js now

(window, (function () {

and previously we had this

"undefined"!=typeof self?self:this

which allowed to run node-forge inside web workers.
Possible solution? Apply this to webpack.config.js

module.exports = {
  // ...
  output: {
    globalObject: 'this'
  }
};
output.
@ChaosEngine
Copy link
Author

My use case is like this:
in web worker I execute importScripts('forge.min.js'); which is failing with
image

ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Sep 19, 2020
… bootstrap-table; Internal fix for digitalbazaar/forge#818 (new build 0.10.0 version is not working inside web workers)
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Sep 19, 2020
… bootstrap-table; Internal fix for digitalbazaar/forge#818 (new build 0.10.0 version is not working inside web workers)
@ChaosEngine
Copy link
Author

on worker side, adding below seems to resolve problem:
window = self;

@iamdevelopergirl
Copy link

@ChaosEngine That actually worked. Thanks

@shahata
Copy link

shahata commented Dec 12, 2020

+1

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

Successfully merging a pull request may close this issue.

3 participants