chrisvander / zustand-computed

A Zustand middleware to create computed states.
MIT License
88 stars 10 forks source link

`SyntaxError: Unexpected token 'export'` in `node_modules/zustand-computed/dist/index.mjs:87` #37

Open SouroucheB opened 1 month ago

SouroucheB commented 1 month ago

Hello there,

I'm getting this error when I run a very basic test in Jest :

describe('Page', () => {
  it('should render the page', async () => {
    render(<Page />)
  })
})

I saw that we are using zustand-computed in stores that are used in the tested page and removing them is fixing the issue.

FYI, I've tried to mock zustand, I also try to update Jest config to tell him to transform the zustand-computed mjs files in usable js.

chrisvander commented 1 week ago

Is your app otherwise ES Module based?