Closed nmassi closed 4 years ago
I am using react, just imported the fontkit module and I got this error:
TypeError: __webpack_require__(...).readFileSync is not a function (anonymous function) src/opentype/shapers/ArabicShaper.js:5
src/opentype/sharpers/ArabicSharper.js
const trie = new UnicodeTrie(require('fs').readFileSync(__dirname + '/data.trie'));
Does anyone know if it there a workaround to fix webpack when using create-react-app?
Using import fk from 'fontkit/base' instead of 'fontkit' seems to solve the problem. Does anyone knows why is this?
import fk from 'fontkit/base'
'fontkit'
I am using react, just imported the fontkit module and I got this error:
src/opentype/sharpers/ArabicSharper.js
const trie = new UnicodeTrie(require('fs').readFileSync(__dirname + '/data.trie'));
Does anyone know if it there a workaround to fix webpack when using create-react-app?