Zukeeper icon indicating copy to clipboard operation
Zukeeper copied to clipboard

🙋 🙋 SyntaxError: Cannot use import statement outside a module

Open ipadorusa opened this issue 1 year ago • 3 comments

Hello~

'next.js' is being used and if you try to run the code below, you will get an error. Please check it.

javascript import { create } from 'zustand' import zukeeper from 'zukeeper'

const initialState = { count: 0 } const CounterStore = create( zukeeper((set) => ({ ...initialState, increment: () => set((state) => ({ count: state.count + 1 })), decrement: () => set((state) => ({ count: state.count - 1 })), resetCounterStore: () => set(initialState) })) )

window.store = CounterStore

export default CounterStore

ipadorusa avatar Apr 06 '23 07:04 ipadorusa

Same issue here. Probably due to the SSR in nextjs.

hungrymike avatar Apr 21 '23 01:04 hungrymike

Same issue here but Typescript

Kingrashy12 avatar Jul 03 '23 08:07 Kingrashy12

Don't want to hate on this package nor the authors - I really like the idea and effort - but FYI: it just works with redux devtools https://github.com/pmndrs/zustand#redux-devtools

bastibuck avatar Jul 05 '23 05:07 bastibuck