Error while building project due to stale/unupdated dependencies in @microsoft/ocsdk
aanand07 opened this issue · 2 comments
After installing latest version 1.1.1-main.2f608b7 and building the project, I'm getting below error
I looked into it and found that @microsoft/ocsdk has dependency on webpack 4, and from error log
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
So we need to update the dependencies in @microsoft/ocsdk project.
Note:- I was able to work the around the issue by following the suggestions, and added below in my webpack config after installing both dependencies.
fallback: {
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
},
webpack
is a dev dependency which means, it's just being installed on development and not in production. webpack
is being used to build the CDN package.
On v4
, the node modules (crypto, stream, etc) were part of webpack, which means users won't have to manually install them to be able to use them. On v5
, these dependencies are no longer part of webpack, so it must be manually installed.
It's by design by webpack v5
.
Thanks for your reply @xTEddie .
Shouldn't the dependencies be resolved and fixed in the library itself, instead of expecting the end user to fix/workaround it.
Least we could have this limitation/prerequisite mentioned in Readme
file for the end user to work around this.
I was trying to fix the issue in @microsoft/ocsdk
by upgrading the packages and replacing crypto
with crypto-browserify
in SDK.ts but it has a indirect dependency on node.js core module stream
in cipher-base
.