wnabil / ngx-export-as

Angular 2+ / Ionic 2+ HTML/table element to export it as JSON, XML, PNG, CSV, TXT, MS-Word, Ms-Excel, PDF
MIT License
68 stars 40 forks source link

Upgrade to 1.13 with Angular 13 fails due to xmlbuilder2 dependency #103

Closed frinux closed 2 years ago

frinux commented 2 years ago

I just upgraded my project to Angular 13. Upgraded also ngx-export-as to 1.13.0 to be compatible.

Compilation fails:

./node_modules/xmlbuilder2/lib/builder/dom.js:5:15-30 - Error: Module not found: Error: Can't resolve 'util' in '/home/francois/Sources/ClimatePositive/soaas/node_modules/xmlbuilder2/lib/builder'

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: { "util": require.resolve("util/") }'
        - install 'util'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "util": false }

The xmlbuilder2 dependency is coming from html-to-docx:

xxxx@laptop:~/Sources/project$ npm ls xmlbuilder2
project@0.0.0 /home/xxxx/Sources/project
└─┬ ngx-export-as@1.13.0
  └─┬ html-to-docx@1.2.4
    └── xmlbuilder2@2.1.2
wnabil commented 2 years ago

https://github.com/wnabil/ngx-export-as/issues/99