only-cliches / Nano-SQL

Universal database layer for the client, server & mobile devices. It's like Lego for databases.
https://nanosql.io
MIT License
781 stars 49 forks source link

Question: Can I use nano-sql in cocos creator? #82

Open boy12371 opened 6 years ago

boy12371 commented 6 years ago

I tried to use it in cocos but it didn't work. It shows: ERROR: TypeError: undefined is not a constructor (evaluating 'new index_1.NanoSQLDefaultBackend()'), location: __node_modules/nano-sql/lib/index.js:65:49 6c4b662f-72ab-4ce4-af7c-3a4db9ec04c8

only-cliches commented 6 years ago

I'm not familiar with Cocos Creator, I never heard it before this issue!

After doing some research I think the problem is you need to import the nano-sql bundle instead of the nodejs module.

So you should use the single file bundle here: https://raw.githubusercontent.com/ClickSimply/Nano-SQL/master/dist/nano-sql.min.js instead of importing it using require statements.

boy12371 commented 6 years ago

1 2 It still didn't work.

only-cliches commented 6 years ago

I'm not familiar with Coco's creator at all, hopefully someone with more experience can hop in here and help out.

Otherwise I'm not sure what's causing this bug and I won't have several hours to learn Cocos creator and dig into this for quite a while.