reZach / secure-electron-store

A secure electron-store that uses ipcMain/ipcRenderer.
MIT License
51 stars 2 forks source link

@msgpack/msgpack bumped to latest in 1.4.0 breaks secure-electron-template #6

Closed morwoen closed 3 years ago

morwoen commented 3 years ago

In this commit (note the line is in package-lock so you need to expand the file to see the line) https://github.com/reZach/secure-electron-store/commit/844f64ccdc115af8818891c8614baf24966619e1#diff-053150b640a7ce75eff69d1a22cae7f0f94ad64ce9a855db544dda0929316519R5249

The @msgpack/msgpack is bumped to 2.5.1 which is the latest version. In that version, it uses .mjs files. Sadly these files are not handled by ProvidePlugin (see https://github.com/webpack/webpack/issues/7032).

The following error is being logged:

[1] ERROR in ./node_modules/@msgpack/msgpack/dist.es5+esm/utils/utf8.mjs 1:38-45
[1] Module not found: Error: Can't resolve 'process/browser' in '<path_to_project>/node_modules/@msgpack/msgpack/dist.es5+esm/utils'
[1] Did you mean 'browser.js'?
[1] BREAKING CHANGE: The request 'process/browser' failed to resolve only because it was resolved as fully specified
[1] (probably because the origin is a '*.mjs' file or a '*.js' file where the package.json contains '"type": "module"').

Creating an issue instead of contributing a fix as I am not sure what the correct resolution would be. NPM is rightfully thinking there are no breaking changes so it updates to the latest. package-lock can be reverted or package.json can be changed to specific version instead. Or an alternative I cannot think of 😅

reZach commented 3 years ago

@morwoen Can you try to change process/browser as my commit has done and tell me if that fixes it for you?

morwoen commented 3 years ago

@reZach Thanks a lot, works like a charm. I should have checked if you made commits to the template as well 😅 . This is the first time I am using a github template and I should figure out a way to keep up to date with it :)

reZach commented 3 years ago

@morwoen no worries! I'm glad the fix works for you!