Drarig29 / brackets-manager.js

A simple library to manage tournament brackets (round-robin, single elimination, double elimination).
https://drarig29.github.io/brackets-docs
MIT License
245 stars 38 forks source link

loader error when using with React #170

Closed dixitt5 closed 1 year ago

dixitt5 commented 1 year ago

Hey guys, hope you're doing well. I'm trying to implement brackets by using React, somehow getting this error. I will be thankful to you guys if you help me with this. (I'm stuck on this issue for so long) here's the error I'm getting:

./node_modules/brackets-json-db/dist/index.js 12:10 Module parse failed: Unexpected token (12:10)

File was processed with these loaders:

./node_modules/react-scripts/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | const clone = rfdc(); | class JsonDatabase { -> internal; | /* | Creates an instance of JsonDatabase, an implementation of CrudInterface for a json file.

Drarig29 commented 1 year ago

You cannot use the JsonDatabase (from package brackets-json-db) in the browser. This is only supported on Node.js, since it reads the filesystem.

For the browser, you should either have a backend which returns the data for you, or if you want to stay in the browser, you can use brackets-memory-db.

This could be named better, I agree... 😕