Skip to content
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

Akita 7 fails in jest because we are missing type:module from package.json #778

Open
leon opened this issue Dec 2, 2021 · 12 comments
Open

Comments

@leon
Copy link

leon commented Dec 2, 2021

Is this a regression?

Yes

Description

The akita package.json does not include "type": "module"
https://unpkg.com/browse/@datorama/akita@7.0.1/package.json

and node will treat "main" field as commonjs if not specified.
https://nodejs.org/api/esm.html#esm_enabling

I'm not sure if this is the only thing that needs doing for it to work, but I'm guessing someone else knows :)

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

SyntaxError: Unexpected token 'export'

Please provide the environment you discovered this bug in

jest 27.4.3
akita 7.0.1

Anything else?

No response

Do you want to create a pull request?

No

@MaChristmann
Copy link

+1 Same here with

jest 27.4.3
akita 7.0.1

@Burgov
Copy link

Burgov commented Dec 30, 2021

any workarounds? Adding "type": "module" to node_modules/@datorama/akita/package.json doesn't help.

@tony
Copy link
Contributor

tony commented Jan 15, 2022

I am also getting this.

Diff: tony/cv@bf4d4a1
CI run w/ error: https://github.com/tony/cv/runs/4826668166?check_suite_focus=true

@tony
Copy link
Contributor

tony commented Jan 15, 2022

@NetanelBasal Any details on this?

tony added a commit to tony/cv that referenced this issue Jan 15, 2022
@tony
Copy link
Contributor

tony commented Jan 15, 2022

@NathanAlcantara I appreciate the link! Thank you.

Hm, I still don't have an idea what's going on.

Any idea on what's changed in Akita between 6 and 7 that could be causing this issue?

Regarding the the type: module in package.json, what would be the impact on that? (I assume there are structural / build reasons not to do that?)

@NetanelBasal
Copy link
Collaborator

I'm not sure. I didn't change anything. I think it is something with Jest.

@DonTomato
Copy link

@NetanelBasal if I downgrade Akita to vrs 6.2.0, it works fine with same version of jest.

@tony
Copy link
Contributor

tony commented Jan 16, 2022

@NetanelBasal And at #778 (comment) I have a diff and CI runs shows specifically that updating 6 -> 7

However, that still doesn't preclude the issue being rooted our own project's environmental / config issues rather than akita's build/packaging/etc. It could still be our environment's were / have become incorrect and something underneath the hood, e.g. an inner dependency, brought it to the forefront

@NetanelBasal
Copy link
Collaborator

We are not doing anything special. We're using Nx to build the package. Is there any issue in Nx regarding what you describe?

@theorlovsky
Copy link
Contributor

Maybe this will help you #781 (comment)

@kvetis
Copy link

kvetis commented Aug 2, 2022

@NetanelBasal I consulted the NX docs and could not find any mentions on how to build multiple module types. Pre nx13 akita had many module systems bundled and referenced in the package.json, now only the ESModule version is bundled. My personal preference would be to try to continue to support multiple module types. Maybe building with @nrwl/angular:package would support more module types out of the box?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants