-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not able to integrate this library for ReactJS. Guidelines / Fix needed. #30
Comments
Try linebreak-next. When used with webpack or rollup should work |
thx. But that package is sort of clone of the original one, but fixing the fs.readFileSync issue. I think it will be great if Arthur can do the same as you do. meanwhile, I am able to make it work using Webpack 5. In case any one wanted to fix the issues: npm install transform-loader buffer --save in webpack.config.js In your .js file (transform-loader will load the file and replace it with base64 string and then use Buffer to convert back to the format it needed. However, buffer is not natively supported, so we need to include that package) const {Buffer} = require("buffer"); |
It is usually solved using brfs as mentioned above. |
in the source code "const data = base64.toByteArray(fs.readFileSync(__dirname + '/classes.trie', 'base64'));"
since browser doesn't have fs.readFileSync supports, some pre build transform is needed to load the classes.tire during build time. Anyone has some guidelines how I can do this in ReactJS? Thanks!
-- recommendations for author , instead of loading the file using fs, we might use
// const data = base64.toByteArray(fs.readFileSync(__dirname + '/classes.trie', 'base64'));
// convert the classes.tire as base64 string in JS files
const classData = "AA4IAAAAAAAAAhqg5VV7NJtZvz7fTC8zU5d.........";
const data = base64.toByteArray(classData);
The text was updated successfully, but these errors were encountered: