-
-
Notifications
You must be signed in to change notification settings - Fork 58
Social network example is failing #239
Description
Describe the bug
The example at examples/social-network
is failing.
How to Reproduce
Try going to this folder, and running npm run dev
on any of the Glee apps.
It fails because the lowdb
package is an ES Module (those using import
instead of require
) and we're compiling all the Typescript code (except node_modules
) to CommonJS modules (those using require
instead of import
). Therefore, it doesn't expect an import
keyword and fails.
Expected behavior
It should support ES Modules out of the box. There will be more and more packages migrating to ES Modules over time as it's the new standard. ES modules can import
CommonJS modules but CommonJS modules can't require
ES Modules.
It should be easy to do. Initially, Glee supported them very well but after the Typescript migration (#212 and #213) it got broken. Changing all the code to ES Modules (and adding back .js
extension to all import
s) should be fine except for Jest mock of fs/promises
in the test/lib/functions.test.ts
file, which doesn't work yet with ESM.
I think a good and quick solution would be to just get rid of this test for now until Jest supports ESM. Check the progress (or even better, contribute) at jestjs/jest#10976.