Skip to content

Change binding resolution to mitigate "Module parse failed" errors#366

Merged
ranisalt merged 4 commits intoranisalt:masterfrom
Voltra:feature/FIX_MODULE_PARSE_FAILED_ISSUES
Dec 27, 2022
Merged

Change binding resolution to mitigate "Module parse failed" errors#366
ranisalt merged 4 commits intoranisalt:masterfrom
Voltra:feature/FIX_MODULE_PARSE_FAILED_ISSUES

Conversation

@Voltra
Copy link
Contributor

@Voltra Voltra commented Dec 17, 2022

Change binding resolution to use the recommended option from @mapbox/node-pre-gyp to hopefully help mitigate issues with build systems and the infamous error "Module parse failed"

@ranisalt
Copy link
Owner

We've been there and done that. This will restore errors #261 #337 which are the reason why there is a direct path in require.

Can you confirm that this change fixes the "module parse failed" issue? I can't reproduce the scenario that has this issue.

cc @jayd-mh and @bplies-ATX which had the original issue, can you test if this change does not cause a regression?

@bplies-ATX
Copy link

@ranisalt I'm not a participant in that project anymore but I've contacted someone that is and asked if they'll check into this.
So I cannot promise if or when it'll happen. I really want to help you because you helped us, but for the moment this is the best that I can do.

@ranisalt
Copy link
Owner

ranisalt commented Dec 19, 2022

@Voltra can you revert all changes except the relevant ones, which are the lines in argon2.js?

I found a way to fix Electron packaging, by adding

  externals: {
    'nock': 'commonjs nock',
    'aws-sdk': 'commonjs aws-sdk',
    'mock-aws-s3': 'commonjs mock-aws-s3',
  }

to the webpack configuration. This will mark these three dependencies to @mapbox/node-pre-gyp as externals, that is, as installed in the base system and therefore not packaged in the Electron app (as far as I understood). These are only used to download prebuilt binaries, and will not be needed in runtime.

That would allow merging this fix and keep working in Electron.

@ranisalt ranisalt merged commit 3b0914f into ranisalt:master Dec 27, 2022
@ranisalt
Copy link
Owner

Thanks!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants