Skip to content
This repository was archived by the owner on Jan 4, 2022. It is now read-only.
This repository was archived by the owner on Jan 4, 2022. It is now read-only.

(? Webpack) unable to resolve schema files without .json file extension  #172

@cloudwheels

Description

@cloudwheels

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:

ERROR in ./node_modules/@dashevo/dpp/lib/document/stateTransition/validation/structure/validateDocumentsBatchTransitionStructureFactory.js
Module not found: Error: Can't resolve '../../../../../schema/document/stateTransition/documentTransition/base' in '/home/nigel/Dev/dashmachine-crypto/node_modules/@dashevo/dpp/lib/document/stateTransition/validation/structure'
 @ ./node_modules/@dashevo/dpp/lib/document/stateTransition/validation/structure/validateDocumentsBatchTransitionStructureFactory.js 12:29-110
 @ ./node_modules/@dashevo/dpp/lib/stateTransition/StateTransitionFacade.js
 @ ./node_modules/@dashevo/dpp/lib/DashPlatformProtocol.js
 @ ./src/dashmachine-crypto.js
 @ multi ./src/dashmachine-crypto.js

ERROR in ./node_modules/@dashevo/dpp/lib/document/stateTransition/validation/structure/validateDocumentsBatchTransitionStructureFactory.js
Module not found: Error: Can't resolve '../../../../../schema/document/stateTransition/documentTransition/create' in '/home/nigel/Dev/dashmachine-crypto/node_modules/@dashevo/dpp/lib/document/stateTransition/validation/structure'
 @ ./node_modules/@dashevo/dpp/lib/document/stateTransition/validation/structure/validateDocumentsBatchTransitionStructureFactory.js 13:31-114
 @ ./node_modules/@dashevo/dpp/lib/stateTransition/StateTransitionFacade.js
 @ ./node_modules/@dashevo/dpp/lib/DashPlatformProtocol.js
 @ ./src/dashmachine-crypto.js
 @ multi ./src/dashmachine-crypto.js

ERROR in ./node_modules/@dashevo/dpp/lib/document/stateTransition/validation/structure/validateDocumentsBatchTransitionStructureFactory.js
Module not found: Error: Can't resolve '../../../../../schema/document/stateTransition/documentTransition/replace' in '/home/nigel/Dev/dashmachine-crypto/node_modules/@dashevo/dpp/lib/document/stateTransition/validation/structure'
 @ ./node_modules/@dashevo/dpp/lib/document/stateTransition/validation/structure/validateDocumentsBatchTransitionStructureFactory.js 14:32-116
 @ ./node_modules/@dashevo/dpp/lib/stateTransition/StateTransitionFacade.js
 @ ./node_modules/@dashevo/dpp/lib/DashPlatformProtocol.js
 @ ./src/dashmachine-crypto.js
 @ multi ./src/dashmachine-crypto.js

ERROR in ./node_modules/@dashevo/dpp/lib/identity/validation/validateIdentityFactory.js
Module not found: Error: Can't resolve '../../../schema/identity/identity' in '/home/nigel/Dev/dashmachine-crypto/node_modules/@dashevo/dpp/lib/identity/validation'
 @ ./node_modules/@dashevo/dpp/lib/identity/validation/validateIdentityFactory.js 1:23-67
 @ ./node_modules/@dashevo/dpp/lib/identity/IdentityFacade.js
 @ ./node_modules/@dashevo/dpp/lib/DashPlatformProtocol.js
 @ ./src/dashmachine-crypto.js
 @ multi ./src/dashmachine-crypto.js

ERROR in ./node_modules/@dashevo/dpp/lib/stateTransition/validation/validateStateTransitionStructureFactory.js
Module not found: Error: Can't resolve '../../../schema/stateTransition/stateTransitionBase' in '/home/nigel/Dev/dashmachine-crypto/node_modules/@dashevo/dpp/lib/stateTransition/validation'
 @ ./node_modules/@dashevo/dpp/lib/stateTransition/validation/validateStateTransitionStructureFactory.js 12:19-81
 @ ./node_modules/@dashevo/dpp/lib/stateTransition/StateTransitionFacade.js
 @ ./node_modules/@dashevo/dpp/lib/DashPlatformProtocol.js
 @ ./src/dashmachine-crypto.js
 @ multi ./src/dashmachine-crypto.js

ERROR in ./node_modules/@dashevo/dpp/lib/validation/JsonSchemaValidator.js
Module not found: Error: Can't resolve '../../schema/dataContract/dataContractMeta' in '/home/nigel/Dev/dashmachine-crypto/node_modules/@dashevo/dpp/lib/validation'
 @ ./node_modules/@dashevo/dpp/lib/validation/JsonSchemaValidator.js 1:31-84
 @ ./node_modules/@dashevo/dpp/lib/DashPlatformProtocol.js
 @ ./src/dashmachine-crypto.js
 @ multi ./src/dashmachine-crypto.js

ERROR in ./node_modules/@dashevo/dpp/lib/stateTransition/StateTransitionFacade.js
Module not found: Error: Can't resolve '../../schema/dataContract/stateTransition/dataContractCreate' in '/home/nigel/Dev/dashmachine-crypto/node_modules/@dashevo/dpp/lib/stateTransition'
 @ ./node_modules/@dashevo/dpp/lib/stateTransition/StateTransitionFacade.js 12:43-114
 @ ./node_modules/@dashevo/dpp/lib/DashPlatformProtocol.js
 @ ./src/dashmachine-crypto.js
 @ multi ./src/dashmachine-crypto.js

ERROR in ./node_modules/@dashevo/dpp/lib/dataContract/validateDataContractFactory.js
Module not found: Error: Can't resolve '../../schema/document/documentBase' in '/home/nigel/Dev/dashmachine-crypto/node_modules/@dashevo/dpp/lib/dataContract'
 @ ./node_modules/@dashevo/dpp/lib/dataContract/validateDataContractFactory.js 6:27-72
 @ ./node_modules/@dashevo/dpp/lib/dataContract/DataContractFacade.js
 @ ./node_modules/@dashevo/dpp/lib/DashPlatformProtocol.js
 @ ./src/dashmachine-crypto.js
 @ multi ./src/dashmachine-crypto.js

ERROR in ./node_modules/@dashevo/dpp/lib/document/validateDocumentFactory.js
Module not found: Error: Can't resolve '../../schema/document/documentBase' in '/home/nigel/Dev/dashmachine-crypto/node_modules/@dashevo/dpp/lib/document'
 @ ./node_modules/@dashevo/dpp/lib/document/validateDocumentFactory.js 2:27-72
 @ ./node_modules/@dashevo/dpp/lib/document/DocumentFacade.js
 @ ./node_modules/@dashevo/dpp/lib/DashPlatformProtocol.js
 @ ./src/dashmachine-crypto.js
 @ multi ./src/dashmachine-crypto.js

ERROR in ./node_modules/@dashevo/dpp/lib/stateTransition/StateTransitionFacade.js
Module not found: Error: Can't resolve '../../schema/document/stateTransition/documentsBatch' in '/home/nigel/Dev/dashmachine-crypto/node_modules/@dashevo/dpp/lib/stateTransition'
 @ ./node_modules/@dashevo/dpp/lib/stateTransition/StateTransitionFacade.js 13:39-102
 @ ./node_modules/@dashevo/dpp/lib/DashPlatformProtocol.js
 @ ./src/dashmachine-crypto.js
 @ multi ./src/dashmachine-crypto.js

ERROR in ./node_modules/@dashevo/dpp/lib/stateTransition/StateTransitionFacade.js
Module not found: Error: Can't resolve '../../schema/identity/stateTransition/identityCreate' in '/home/nigel/Dev/dashmachine-crypto/node_modules/@dashevo/dpp/lib/stateTransition'
 @ ./node_modules/@dashevo/dpp/lib/stateTransition/StateTransitionFacade.js 14:39-102
 @ ./node_modules/@dashevo/dpp/lib/DashPlatformProtocol.js
 @ ./src/dashmachine-crypto.js
 @ multi ./src/dashmachine-crypto.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions