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

Uncaught TypeError: Cannot redefine property: $CryptoJS #27

Open
SevymolSebastian opened this issue Dec 15, 2023 · 1 comment
Open

Uncaught TypeError: Cannot redefine property: $CryptoJS #27

SevymolSebastian opened this issue Dec 15, 2023 · 1 comment

Comments

@SevymolSebastian
Copy link

SevymolSebastian commented Dec 15, 2023

I have installed this module by
npm install vue-cryptojs

version:
"vue-cryptojs": "2.4.5"
"vue": "2.7.14"

Then in main.js

import VueCryptojs from 'vue-cryptojs';
Vue.use(VueCryptojs);

But when I try to use it on my component

const encryptedText = this.$CryptoJS.AES.encrypt("Hi There!", "Secret Passphrase").toString()

Got an error:

Uncaught TypeError: Cannot redefine property: $CryptoJS
    at Function.defineProperties (<anonymous>)
    at Object.install (app.js:329626:383)
    at Vue.use (app.js:343911:28)
    at Object.install (app.js:329626:765)
    at Vue.use (app.js:343911:28)

Also I gon aerror:
[Vue warn]: provide() can only be used inside setup().

How to solve?

@tpenaranda
Copy link
Owner

tpenaranda commented Dec 15, 2023

Mmm... not a Vue expert here, but just a hint... since Vue 2.7 includes composition API, what about using 'setup()' function as the v3 install example? @SevymolSebastian

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

2 participants