1

I have an angular application and want to install @cardano-sdk/core to directly work with Cardano, but during installation I get this error, which seems to be in Cardano files:

./node_modules/@dcspark/cardano-multiplatform-lib-nodejs/cardano_multiplatform_lib.js:35766:11-31 - Error: Module not found: Error: Can't resolve 'path' in '/Users/Lilit_Mazmanyan/WebstormProjects/tez-front/node_modules/@dcspark/cardano-multiplatform-lib-nodejs'

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.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

Here is my webpack.config.js:

const path = require('path');
const webpack = require('webpack');

module.exports = {
  mode: 'development', entry: './src/index.js', output: {
    filename: 'bundle.js', path: path.resolve(__dirname, 'dist'),
  }, resolve: {
    fallback: {
      'path': false
    }
  }
};

I have also tried to have "fs": false, "path": require.resolve("path-browserify"), "buffer": require.resolve("buffer/") instead of the path, but it did not help as well.

And here is package.json:

{
  "name": "tez-front",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^14.2.0",
    "@angular/common": "^14.2.0",
    "@angular/compiler": "^14.2.0",
    "@angular/core": "^14.2.0",
    "@angular/forms": "^14.2.0",
    "@angular/platform-browser": "^14.2.0",
    "@angular/platform-browser-dynamic": "^14.2.0",
    "@angular/router": "^14.2.0",
    "@cardano-sdk/core": "^0.11.0",
    "@types/pouchdb-core": "^7.0.11",
    "pouchdb-core": "^8.0.1",
    "rxjs": "~7.5.0",
    "tslib": "^2.3.0",
    "util": "^0.12.5",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^14.2.11",
    "@angular/cli": "~14.2.11",
    "@angular/compiler-cli": "^14.2.0",
    "@types/blake2b": "^2.1.0",
    "@types/jasmine": "~4.0.0",
    "@types/lodash": "^4.14.194",
    "buffer": "^6.0.3",
    "jasmine-core": "~4.3.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "path-browserify": "^1.0.1",
    "typescript": "~4.7.2"
  }
}

I have seen similar issue, but it did not help to solve the problem.

How do I solve the issue?

0 Answers0