7
import { EncryptStorage } from 'encrypt-storage';

export const encryptStorage = EncryptStorage('secret_key');

encryptStorage.setItem('user', userObj);

error :

enter image description here

I am trying to encrypt the localstorage using encrypt-storage but the import is giving me error and project crashed after putting only 3 line of code.

Dynamic import of next is not working as most of the solution i found is for component not for package.

This solution is not working for dynamic module import as i am getting some assignment error in loader.

Thanks in advance. :)

Tushar
  • 306
  • 5
  • 14
  • 2
    Does this answer your question: [(Webpack) Why am I getting ReferenceError: self is not defined in Next.js when I try to import a client-side library?](https://stackoverflow.com/a/66100185/1870780)? Essentially, you should only import `encrypt-storage` on the client. – juliomalves Aug 06 '21 at 18:28
  • Not working, i tried. still if you can make small example in code sandbox then its more clear for me @juliomalves – Tushar Aug 10 '21 at 09:21

0 Answers0