IM a beginner and I am trying to implement pandoc on a local site. Then my question is it possible to use Pandoc in a react application?
I tried by in the App.js file by typing this:
import './App.css';
import nodePandoc from 'node-pandoc';
let src = './TEST.docx';
// Arguments can be either a single String or in an Array
let args = '-f docx -t markdown -o ./markdown.md';
// Set your callback function
const callback = (err, result)=> {
if (err) console.error('Oh Nos: ',err)
return console.log(result), result
}
// Call pandoc
nodePandoc(src, args, callback);
function App() {
return (
<div className="App">
<h1> .....</h1>
</div>
);
}
export default App;
´´´
However I get this errors:
ERROR in ../../../../node_modules/node-pandoc/index.js 1:11-29
Module not found: Error: Can't resolve 'fs' in 'C:\Users\apinto2\node_modules\node-pandoc'
ERROR in ../../../../node_modules/node-pandoc/index.js 3:12-42
Module not found: Error: Can't resolve 'child_process' in 'C:\Users\apinto2\node_modules\node-pandoc'
webpack compiled with 2 errors and 1 warning
Thank you so much for your help !
CodePudding user response:
I truly believe that is not possible
CodePudding user response:
Go to your package.json and add this lines:
"browser":{
"child_process": false,
"fs": false,
"path": false,
"os": false
}