diff --git a/packages/stores/src/setup.ts b/packages/stores/src/setup.ts index b18c27e3..5269571f 100644 --- a/packages/stores/src/setup.ts +++ b/packages/stores/src/setup.ts @@ -3,7 +3,8 @@ import type { Pinia } from 'pinia'; import type { App } from 'vue'; import { createPinia } from 'pinia'; -import SecureLS from 'secure-ls'; +// vite8报错找不到构造器? +// import SecureLS from 'secure-ls'; let pinia: Pinia; @@ -21,27 +22,28 @@ export async function initStores(app: App, options: InitStoreOptions) { const { createPersistedState } = await import('pinia-plugin-persistedstate'); pinia = createPinia(); const { namespace } = options; - const ls = new SecureLS({ - encodingType: 'aes', - encryptionSecret: import.meta.env.VITE_APP_STORE_SECURE_KEY, - isCompression: true, - // @ts-ignore secure-ls does not have a type definition for this - metaKey: `${namespace}-secure-meta`, - }); + // const ls = new SecureLS({ + // encodingType: 'aes', + // encryptionSecret: import.meta.env.VITE_APP_STORE_SECURE_KEY, + // isCompression: true, + // // @ts-ignore secure-ls does not have a type definition for this + // metaKey: `${namespace}-secure-meta`, + // }); pinia.use( createPersistedState({ // key $appName-$store.id key: (storeKey) => `${namespace}-${storeKey}`, - storage: import.meta.env.DEV - ? localStorage - : { - getItem(key) { - return ls.get(key); - }, - setItem(key, value) { - ls.set(key, value); - }, - }, + storage: localStorage, + // storage: import.meta.env.DEV + // ? localStorage + // : { + // getItem(key) { + // return ls.get(key); + // }, + // setItem(key, value) { + // ls.set(key, value); + // }, + // }, }), ); app.use(pinia);