rt2zz / redux-persist-crosstab

Keep redux browser tab state in sync
85 stars 27 forks source link

[Failed to compile] Module not found: Can't resolve 'redux-persist/constants' in 'redux-persist-crosstab' #22

Open shermendev opened 5 years ago

shermendev commented 5 years ago

Hi, I keep getting this error:

Failed to compile.

./node_modules/redux-persist-crosstab/index.js
Module not found: Can't resolve 'redux-persist/constants' in 'node_modules\redux-persist-crosstab'

"redux-persist-crosstab": "^3.7.0"

Minimum code to reproduce:

import crosstabSync from 'redux-persist-crosstab'

crosstabSync()
shermendev commented 5 years ago

Just tested the 4.0 version, still getting an error "redux-persist-crosstab": "^4.0.0-0"

Failed to compile.

./node_modules/redux-persist-crosstab/index.js
SyntaxError: \node_modules\redux-persist-crosstab\index.js: Unexpected token (3:12)

  1 | // @flow
  2 | import { KEY_PREFIX, REHYDRATE } from 'redux-persist/lib/constants'
> 3 | import type { PersistConfig } from 'redux-persist/es/types'
    |             ^
  4 | import type { Store } from 'redux'
  5 |
  6 | type CrosstabConfig = {
brandoncc commented 5 years ago

I also can't add this. Is there a solution to allow this to be used @rt2zz?

Max-Z80 commented 5 years ago

Hello, I have the same problem here. I think index.js should be transpiled to use terms that nodejs understands such as 'exports' and 'require' instead of 'import'. My current ugly temporary solution was to copy the function to the index.js of my react app, then convert the syntax to js (because that's the syntax I am using for this app), and finally add the proper imports. 2 min work. Works great. I would prefer to use this package instead.