Open cloudwheels opened 4 years ago
@cloudwheels Hm that looks strange. We are building the lib with a webpack when we deploy it to npm, so there's already a minified version of this in the npm package, and it works. It's located under node_modules/@dashevo/dpp/dist/DashPlatformProtocol.min.js
I think we need to add "browser" field pointing to this file in package.json so Webpack won't bundle it twice
"browser" field is evil! :). It breaks build for libraries that use DPP as a dependency.
Context I am working with webpack (4.43.0) to create a bundle for which the npm module @dashevo/dpp@0.12.1 is a dependency.
Webpack is unable to build successfully due to the errors below. On investigation, the require() statements for json schema files do not specify the file extension in the path. Adding the .json extension appears to resolve the issue
I will investigate whether I am able to fully resolve this issue and provide a PR if that is the case.
My assumption is that the library is able to build under other circumstances and this is a webpack issue. Webpack does not require a JSON file loader but there may be a configuration issue as to why files cannot be imported without the extension. There doesn't appear any special configuration related to .json imports in the webpack configuration for the library
Error output from Webpack: