You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 imports) 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.
The text was updated successfully, but these errors were encountered:
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 usingimport
instead ofrequire
) and we're compiling all the Typescript code (exceptnode_modules
) to CommonJS modules (those usingrequire
instead ofimport
). Therefore, it doesn't expect animport
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'trequire
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 allimport
s) should be fine except for Jest mock offs/promises
in thetest/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.
The text was updated successfully, but these errors were encountered: