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

Can't resolve 'fs' in html-to-docx package. I got this error and i dont know to fix it. #106

Closed immanuvel117 closed 2 years ago

immanuvel117 commented 2 years ago

Error: Module not found: Error: Can't resolve 'fs' in '/home/developer2/work/Codes/Mar 4/advocatebook-1.0-advportal-webapp/node_modules/html-to-docx/dist'

i am using angular version 13.2.3

package.json file { "name": "angular", "version": "0.0.0", "browser": { "fs" : false }, "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build --prod --aot false --build-optimizer false", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "~13.2.3", "@angular/cdk": "~13.2.3", "@angular/common": "~13.2.3", "@angular/compiler": "~13.2.3", "@angular/core": "~13.2.3", "@angular/flex-layout": "^13.0.0-beta.38", "@angular/forms": "~13.2.3", "@angular/material": "^13.2.3", "@angular/platform-browser": "~13.2.3", "@angular/platform-browser-dynamic": "~13.2.3", "@angular/router": "~13.2.3", "angular-svg-round-progressbar": "^8.0.0", "buffer": "^6.0.3", "chart.js": "^3.7.1", "core-js": "^3.19.1", "crypto-browserify": "^3.12.0", "crypto-js": "^4.1.1", "file-saver": "^2.0.5", "hammerjs": "^2.0.8", "html-to-docx": "^1.2.4", "jquery": "^3.6.0", "ng-starrating": "^1.0.20", "ng-table-virtual-scroll": "^1.4.0", "ng2-odometer": "^1.1.3", "ng2-pdf-viewer": "^8.0.1", "ngx-cookie-service": "^13.1.2", "ngx-countdown": "^13.0.0", "ngx-doc-viewer": "^2.1.2", "ngx-export-as": "^1.13.0", "ngx-infinite-scroll": "^10.0.1", "ngx-material-timepicker": "^5.5.3", "ngx-perfect-scrollbar": "^10.1.1", "ngx-print": "^1.2.1", "path-browserify": "^1.0.1", "process": "^0.11.10", "protractor-beautiful-reporter": "^1.3.6", "rfc4648": "^1.5.1", "rxjs": "^6.6.0", "rxjs-compat": "^6.6.0", "save-as-file": "^0.3.0", "save-file": "^2.3.1", "screenfull": "^6.0.1", "stream-browserify": "^3.0.0", "tm-ng-odometer": "^1.1.8", "tslib": "^2.3.1", "url": "^0.11.0", "util": "^0.12.4", "xlsx": "^0.17.4", "zone.js": "~0.11.4", "html2pdf.js": "^0.10.1"

}, "devDependencies": { "@angular-devkit/build-angular": "~13.2.4", "@angular-devkit/build-ng-packagr": "~0.1002.0", "@angular/cli": "~13.2.4", "@angular/compiler-cli": "~13.2.3", "@angular/language-service": "~13.2.3", "@types/jasmine": "~3.10.3", "@types/jasminewd2": "~2.0.10", "@types/node": "~17.0.19", "codelyzer": "^6.0.2", "jasmine-core": "~4.0.1", "jasmine-spec-reporter": "~7.0.0", "karma": "~6.3.16", "karma-chrome-launcher": "~3.1.0", "karma-coverage-istanbul-reporter": "~3.0.3", "karma-jasmine": "~4.0.1", "karma-jasmine-html-reporter": "^1.7.0", "mocha": "9.2.1", "ng-packagr": "^13.0.7", "protractor": "~7.0.0", "supertest": "6.2.2", "ts-node": "~10.5.0", "tslint": "~5.20.1", "typescript": "~4.5.5", "unit.js": "2.1.1"

} }

immanuvel117 commented 2 years ago

If i add the "browser: {fs : false}" in the html-to-docx package -> package.json , the project is working... But i can't change it every time, I am using ngx-export-as npm package for downloading html as 'docx' file.

wnabil commented 2 years ago

Thanks for the info, seems like html-to-docx needs to be updated will do that and release a new version soon

wnabil commented 2 years ago

docx is not supported with webpack 5, until that time its disabled