index.js depends on 'localforage'. CommonJS or AMD dependencies can cause optimization bailouts
Asked Answered
C

1

6

I got this warning, but I dont understand why 'localforage' depends on CommonJS. I had googled for few days, but I can't find any solution that fit with my problems.

  WARNING
    C:\xxx\node_modules\@ionic\storage\dist\esm\index.js depends on 'localforage'. CommonJS or AMD dependencies can cause optimization bailouts.
    For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

I use ionic storage to store data, and it directly stores in "_ionicstorage > _ionickv". I don't use localforage in any of my pages inside ionic. How to resolve this issue? Should i replace the whole code that uses ionic storage to different storage?

Note: I don't want to add allowed dependencies in angular.json file since it is not fully solved the problem (because that only allow commonJS module instead of resolve the issue).

Cystectomy answered 1/11, 2022 at 14:40 Comment(0)
A
1

Add localforage to allowedCommonJsDependencies in angular.json

"build": {
  "options": {
    "allowedCommonJsDependencies": [
      "localforage"
    ]
  }
}

Thank you!

Anzus answered 17/6 at 7:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.