I tried to use mammoth for extracting text from word files in my Angular project. But it won't work. It gives error:
path.js:25 Uncaught ReferenceError: process is not defined
at 4943 (path.js:25:17)
at __webpack_require__ (bootstrap:19:1)
at 92839 (docx-reader.js:4:12)
at __webpack_require__ (bootstrap:19:1)
at 88933 (index.js:3:18)
at __webpack_require__ (bootstrap:19:1)
at 27345 (taskrolecreator.component.html:71:24)
at __webpack_require__ (bootstrap:19:1)
at 44547 (comments.component.html:58:133)
at __webpack_require__ (bootstrap:19:1)
The error doesn't appear when I remove the following method. This method is not even executed cause the error occurs at launch of the page.
mammoth.extractRawText(file)
.then(result => {
const html = result.value;
const messages = result.messages;
})
I installed it and imported in my component:
import * as mammoth from 'mammoth';
There is similar question but without an answer.