-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
bugSomething isn't workingSomething isn't workingquestionFurther information is requestedFurther information is requested
Description
I tried to use localStorage to store an object from another library and get this error:
TypeError: e2.constructor is undefined
a index.mjs:1
a index.mjs:1
a index.mjs:1
A index.mjs:1
setValue index.mjs:1
x index.mjs:1
subscribe index.mjs:1
x index.mjs:1
X index.mjs:1
H index.mjs:1
<anonymous> store.js:19
app.js:16:41
Steps to reproduce:
npm create svelte@latest my_test(doesn't matter the configuration, tested with skeleton app, without types and with typescript, no linter etc)- install this library and another external one:
npm install @macfja/svelte-persistent-storeandnpm install obs-websocket-js - create src/routes/store.js:
import { localWritable } from "@macfja/svelte-persistent-store"
import { writable } from "svelte/store"
import OBSWebSocket from 'obs-websocket-js';
export class BaseMyObj {}
class MyObj extends BaseMyObj {}
// export const obs = writable( new OBSWebSocket() ) // works
export const myobj = localWritable( "myobj" , new MyObj() ) // works
export const obs = localWritable( "obs" , new OBSWebSocket() ) // error
- use store.js in +page.svelte:
import { myobj } from "./store"
I am fairly new to webdev/js/svelte so it might be an error on my side.
What I have tried so far:
- changed the sveltekit configuration (JS/TS) with the same error
- tried to dig into the error itself, but there is no
e2ore2.constructoranywhere in the minified JS in the browser - tried to recreate the error with a custom class (that extends a base class) in JS/TS, these work just fine
- also used the base functions (
persistand all the available alias for localstorage) with the same error
I guess this error may be specific for the combination of those two libraries, however I lack the insight of both libraries to get into it deeper, especially with other 3rd party packages
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingquestionFurther information is requestedFurther information is requested