pmndrs / swc-jotai

MIT License
90 stars 14 forks source link

Crash when using with Next.js config #6

Closed phuctm97 closed 1 year ago

phuctm97 commented 1 year ago

My Next.js crashed when I add this config to next.config.js:

experimental: {
    swcPlugins: [
      ["@swc-jotai/debug-label", {}],
      ["@swc-jotai/react-refresh", {}],
    ],
  },

Console logs:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', /Users/thisen/.cargo/registry/src/github.com-1ecc6299db9ec823/rkyv-0.7.37/src/impls/core/mod.rs:thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError265thread ':67
', /Users/thisen/.cargo/registry/src/github.com-1ecc6299db9ec823/rkyv-0.7.37/src/impls/core/mod.rs:265:67
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', /Users/thisen/.cargo/registry/src/github.com-1ecc6299db9ec823/rkyv-0.7.37/src/impls/core/mod.rs:265:67
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/phuctm97/Projects/media-ui/web/pages/_app.tsx")'

Caused by:
    0: failed to invoke `/Users/phuctm97/Projects/media-ui/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm` as js transform plugin at /Users/phuctm97/Projects/media-ui/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm
    1: RuntimeError: out of bounds memory access
    2: heap_get_oob', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.242.2/src/plugin.rs:228:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/phuctm97/Projects/media-ui/web/node_modules/next/dist/client/next-dev.js")'

Caused by:
    0: failed to invoke `/Users/phuctm97/Projects/media-ui/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm` as js transform plugin at /Users/phuctm97/Projects/media-ui/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm
    1: RuntimeError: call stack exhausted
    2: stk_ovf', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.242.2/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/phuctm97/Projects/media-ui/web/node_modules/next/dist/client/router.js")'

Caused by:
    0: failed to invoke `/Users/phuctm97/Projects/media-ui/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm` as js transform plugin at /Users/phuctm97/Projects/media-ui/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm
    1: RuntimeError: call stack exhausted
    2: stk_ovf', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.242.2/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/phuctm97/Projects/media-ui/web/node_modules/next/dist/client/dev/amp-dev.js")'

Caused by:
    0: failed to invoke `/Users/phuctm97/Projects/media-ui/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm` as js transform plugin at /Users/phuctm97/Projects/media-ui/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm
    1: RuntimeError: call stack exhausted
    2: stk_ovf', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.242.2/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/phuctm97/Projects/media-ui/web/node_modules/next/dist/pages/_error.js")'

Caused by:
    0: failed to invoke `/Users/phuctm97/Projects/media-ui/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm` as js transform plugin at /Users/phuctm97/Projects/media-ui/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm
    1: RuntimeError: out of bounds memory access
    2: heap_get_oob', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.242.2/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/phuctm97/Projects/media-ui/web/pages/_app.tsx")'

Caused by:
    0: failed to invoke `/Users/phuctm97/Projects/media-ui/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm` as js transform plugin at /Users/phuctm97/Projects/media-ui/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm
    1: RuntimeError: out of bounds memory access
    2: heap_get_oob', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.242.2/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/phuctm97/Projects/media-ui/web/node_modules/next/dist/pages/_error.js")'

Caused by:
    0: failed to invoke `/Users/phuctm97/Projects/media-ui/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm` as js transform plugin at /Users/phuctm97/Projects/media-ui/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm
    1: RuntimeError: out of bounds memory access
    2: heap_get_oob', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.242.2/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/phuctm97/Projects/media-ui/web/pages/_document.tsx")'

Caused by:
    0: failed to invoke `/Users/phuctm97/Projects/media-ui/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm` as js transform plugin at /Users/phuctm97/Projects/media-ui/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm
    1: RuntimeError: out of bounds memory access
    2: heap_get_oob', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.242.2/src/plugin.rs:228:14
error - ./node_modules/next/dist/client/dev/amp-dev.js
Error: failed to process failed to invoke plugin: failed to invoke plugin on 'Some("/Users/phuctm97/Projects/media-ui/web/node_modules/next/dist/client/dev/amp-dev.js")'

Caused by:
    0: failed to invoke `/Users/phuctm97/Projects/media-ui/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm` as js transform plugin at /Users/phuctm97/Projects/media-ui/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm
    1: RuntimeError: call stack exhausted
    2: stk_ovf

I notice there is Users/thisen value mentioned but this user is not on my machine, maybe some hard-coded issue?

himself65 commented 1 year ago

same error here on nextjs 13.2.0

himself65 commented 1 year ago

comment ['@swc-jotai/react-refresh', {}], is works for me

timfee commented 1 year ago

Same on next: 13.2.4-canary.2

Thisen commented 1 year ago

Looking into it :)

Thisen commented 1 year ago

Try latest version of the plugins please!

Reopen if the issue remains.

phuctm97 commented 1 year ago

Thanks for looking into it @Thisen. Looks like the issue changed into something else:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: ExportDecl(ExportDecl { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, decl: Var(VarDecl { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, kind: "const", declare: false, decls: [VarDeclarator { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #1 }, name: Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #1 }, sym: Atom('messagesAtomFamiLy' type=dynamic), optional: false }, type_ann: None }), init: Some(Call(CallExpr { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, callee: Expr(Member(MemberExpr { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, obj: Member(MemberExpr { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, obj: Ident(Ident { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, sym: Atom('globalThis' type=dynamic), optional: false }), prop: Ident(Ident { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, sym: Atom('jotaiAtomCache' type=dynamic), optional: false }) }), prop: Ident(Ident { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, sym: Atom('get' type=static), optional: false }) })), args: [ExprOrSpread { spread: None, expr: Lit(Str(Str { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, value: Atom('/Users/phuctm97/Projects/chatfriday/web/modules/client/message.ts/messagesAtomFamiLy' type=dynamic), raw: None })) }, ExprOrSpread { spread: None, expr: Call(CallExpr { span: Span { lo: BytePos(11571), hi: BytePos(11970), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(11571), hi: BytePos(11575), ctxt: #1 }, sym: Atom('atom' type=inline), optional: false })), args: [ExprOrSpread { spread: None, expr: Arrow(ArrowExpr { span: Span { lo: BytePos(11641), hi: BytePos(11666), ctxt: #0 }, params: [Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(11642), hi: BytePos(11645), ctxt: #4 }, sym: Atom('get' type=static), optional: false }, type_ann: None })], body: Expr(Call(CallExpr { span: Span { lo: BytePos(11650), hi: BytePos(11666), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(11650), hi: BytePos(11653), ctxt: #4 }, sym: Atom('get' type=static), optional: false })), args: [ExprOrSpread { spread: None, expr: Ident(Ident { span: Span { lo: BytePos(11654), hi: BytePos(11665), ctxt: #3 }, sym: Atom('storageAtom' type=dynamic), optional: false }) }], type_args: None })), is_async: false, is_generator: false, type_params: None, return_type: None }) }, ExprOrSpread { spread: None, expr: Arrow(ArrowExpr { span: Span { lo: BytePos(11672), hi: BytePos(11966), ctxt: #0 }, params: [Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(11679), hi: BytePos(11682), ctxt: #5 }, sym: Atom('get' type=static), optional: false }, type_ann: None }), Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(11684), hi: BytePos(11687), ctxt: #5 }, sym: Atom('set' type=static), optional: false }, type_ann: None }), Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(11689), hi: BytePos(11694), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }, type_ann: None })], body: BlockStmt(BlockStmt { span: Span { lo: BytePos(11699), hi: BytePos(11966), ctxt: #0 }, stmts: [Expr(ExprStmt { span: Span { lo: BytePos(11707), hi: BytePos(11737), ctxt: #0 }, expr: Await(AwaitExpr { span: Span { lo: BytePos(11707), hi: BytePos(11736), ctxt: #0 }, arg: Call(CallExpr { span: Span { lo: BytePos(11713), hi: BytePos(11736), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(11713), hi: BytePos(11716), ctxt: #5 }, sym: Atom('set' type=static), optional: false })), args: [ExprOrSpread { spread: None, expr: Ident(Ident { span: Span { lo: BytePos(11717), hi: BytePos(11728), ctxt: #3 }, sym: Atom('storageAtom' type=dynamic), optional: false }) }, ExprOrSpread { spread: None, expr: Ident(Ident { span: Span { lo: BytePos(11730), hi: BytePos(11735), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }) }], type_args: None }) }) }), Decl(Var(VarDecl { span: Span { lo: BytePos(11744), hi: BytePos(11787), ctxt: #0 }, kind: "const", declare: false, decls: [VarDeclarator { span: Span { lo: BytePos(11750), hi: BytePos(11786), ctxt: #0 }, name: Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(11750), hi: BytePos(11754), ctxt: #5 }, sym: Atom('chat' type=inline), optional: false }, type_ann: None }), init: Some(Await(AwaitExpr { span: Span { lo: BytePos(11757), hi: BytePos(11786), ctxt: #0 }, arg: Call(CallExpr { span: Span { lo: BytePos(11763), hi: BytePos(11786), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(11763), hi: BytePos(11766), ctxt: #5 }, sym: Atom('get' type=static), optional: false })), args: [ExprOrSpread { spread: None, expr: Call(CallExpr { span: Span { lo: BytePos(11767), hi: BytePos(11785), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(11767), hi: BytePos(11781), ctxt: #1 }, sym: Atom('chatAtomFamily' type=dynamic), optional: false })), args: [ExprOrSpread { spread: None, expr: Ident(Ident { span: Span { lo: BytePos(11782), hi: BytePos(11784), ctxt: #3 }, sym: Atom('id' type=static), optional: false }) }], type_args: None }) }], type_args: None }) })), definite: false }] })), Decl(Var(VarDecl { span: Span { lo: BytePos(11794), hi: BytePos(11920), ctxt: #0 }, kind: "const", declare: false, decls: [VarDeclarator { span: Span { lo: BytePos(11800), hi: BytePos(11919), ctxt: #0 }, name: Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(11800), hi: BytePos(11807), ctxt: #5 }, sym: Atom('newChat' type=inline), optional: false }, type_ann: None }), init: Some(Object(ObjectLit { span: Span { lo: BytePos(11816), hi: BytePos(11919), ctxt: #0 }, props: [Spread(SpreadElement { dot3_token: Span { lo: BytePos(11826), hi: BytePos(11829), ctxt: #0 }, expr: Ident(Ident { span: Span { lo: BytePos(11829), hi: BytePos(11833), ctxt: #5 }, sym: Atom('chat' type=inline), optional: false }) }), Prop(KeyValue(KeyValueProp { key: Ident(Ident { span: Span { lo: BytePos(11843), hi: BytePos(11855), ctxt: #0 }, sym: Atom('startMessage' type=dynamic), optional: false }), value: Member(MemberExpr { span: Span { lo: BytePos(11857), hi: BytePos(11865), ctxt: #0 }, obj: Ident(Ident { span: Span { lo: BytePos(11857), hi: BytePos(11862), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }), prop: Computed(ComputedPropName { span: Span { lo: BytePos(11862), hi: BytePos(11865), ctxt: #0 }, expr: Lit(Num(Number { span: Span { lo: BytePos(11863), hi: BytePos(11864), ctxt: #0 }, value: 0.0, raw: Some("0") })) }) }) })), Prop(KeyValue(KeyValueProp { key: Ident(Ident { span: Span { lo: BytePos(11875), hi: BytePos(11885), ctxt: #0 }, sym: Atom('endMessage' type=dynamic), optional: false }), value: Member(MemberExpr { span: Span { lo: BytePos(11887), hi: BytePos(11910), ctxt: #0 }, obj: Ident(Ident { span: Span { lo: BytePos(11887), hi: BytePos(11892), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }), prop: Computed(ComputedPropName { span: Span { lo: BytePos(11892), hi: BytePos(11910), ctxt: #0 }, expr: Bin(BinExpr { span: Span { lo: BytePos(11893), hi: BytePos(11909), ctxt: #0 }, op: "-", left: Member(MemberExpr { span: Span { lo: BytePos(11893), hi: BytePos(11905), ctxt: #0 }, obj: Ident(Ident { span: Span { lo: BytePos(11893), hi: BytePos(11898), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }), prop: Ident(Ident { span: Span { lo: BytePos(11899), hi: BytePos(11905), ctxt: #0 }, sym: Atom('length' type=static), optional: false }) }), right: Lit(Num(Number { span: Span { lo: BytePos(11908), hi: BytePos(11909), ctxt: #0 }, value: 1.0, raw: Some("1") })) }) }) }) }))] })), definite: false }] })), Expr(ExprStmt { span: Span { lo: BytePos(11927), hi: BytePos(11960), ctxt: #0 }, expr: Call(CallExpr { span: Span { lo: BytePos(11927), hi: BytePos(11959), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(11927), hi: BytePos(11930), ctxt: #5 }, sym: Atom('set' type=static), optional: false })), args: [ExprOrSpread { spread: None, expr: Call(CallExpr { span: Span { lo: BytePos(11931), hi: BytePos(11949), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: Bytthread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/phuctm97/Projects/chatfriday/web/modules/client/message.ts")'

Caused by:
    0: failed to invoke `/Users/phuctm97/Projects/chatfriday/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm` as js transform plugin at /Users/phuctm97/Projects/chatfriday/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm
    1: RuntimeError: call stack exhausted
    2: stk_ovf', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.245.27/src/plugin.rs:228:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: ExportDecl(ExportDecl { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, decl: Var(VarDecl { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, kind: "const", declare: false, decls: [VarDeclarator { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #1 }, name: Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #1 }, sym: Atom('messagesAtomFamiLy' type=dynamic), optional: false }, type_ann: None }), init: Some(Call(CallExpr { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, callee: Expr(Member(MemberExpr { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, obj: Member(MemberExpr { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, obj: Ident(Ident { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, sym: Atom('globalThis' type=dynamic), optional: false }), prop: Ident(Ident { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, sym: Atom('jotaiAtomCache' type=dynamic), optional: false }) }), prop: Ident(Ident { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, sym: Atom('get' type=static), optional: false }) })), args: [ExprOrSpread { spread: None, expr: Lit(Str(Str { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, value: Atom('/Users/phuctm97/Projects/chatfriday/web/modules/client/message.ts/messagesAtomFamiLy' type=dynamic), raw: None })) }, ExprOrSpread { spread: None, expr: Call(CallExpr { span: Span { lo: BytePos(30331), hi: BytePos(30730), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(30331), hi: BytePos(30335), ctxt: #1 }, sym: Atom('atom' type=inline), optional: false })), args: [ExprOrSpread { spread: None, expr: Arrow(ArrowExpr { span: Span { lo: BytePos(30401), hi: BytePos(30426), ctxt: #0 }, params: [Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(30402), hi: BytePos(30405), ctxt: #4 }, sym: Atom('get' type=static), optional: false }, type_ann: None })], body: Expr(Call(CallExpr { span: Span { lo: BytePos(30410), hi: BytePos(30426), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(30410), hi: BytePos(30413), ctxt: #4 }, sym: Atom('get' type=static), optional: false })), args: [ExprOrSpread { spread: None, expr: Ident(Ident { span: Span { lo: BytePos(30414), hi: BytePos(30425), ctxt: #3 }, sym: Atom('storageAtom' type=dynamic), optional: false }) }], type_args: None })), is_async: false, is_generator: false, type_params: None, return_type: None }) }, ExprOrSpread { spread: None, expr: Arrow(ArrowExpr { span: Span { lo: BytePos(30432), hi: BytePos(30726), ctxt: #0 }, params: [Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(30439), hi: BytePos(30442), ctxt: #5 }, sym: Atom('get' type=static), optional: false }, type_ann: None }), Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(30444), hi: BytePos(30447), ctxt: #5 }, sym: Atom('set' type=static), optional: false }, type_ann: None }), Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(30449), hi: BytePos(30454), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }, type_ann: None })], body: BlockStmt(BlockStmt { span: Span { lo: BytePos(30459), hi: BytePos(30726), ctxt: #0 }, stmts: [Expr(ExprStmt { span: Span { lo: BytePos(30467), hi: BytePos(30497), ctxt: #0 }, expr: Await(AwaitExpr { span: Span { lo: BytePos(30467), hi: BytePos(30496), ctxt: #0 }, arg: Call(CallExpr { span: Span { lo: BytePos(30473), hi: BytePos(30496), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(30473), hi: BytePos(30476), ctxt: #5 }, sym: Atom('set' type=static), optional: false })), args: [ExprOrSpread { spread: None, expr: Ident(Ident { span: Span { lo: BytePos(30477), hi: BytePos(30488), ctxt: #3 }, sym: Atom('storageAtom' type=dynamic), optional: false }) }, ExprOrSpread { spread: None, expr: Ident(Ident { span: Span { lo: BytePos(30490), hi: BytePos(30495), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }) }], type_args: None }) }) }), Decl(Var(VarDecl { span: Span { lo: BytePos(30504), hi: BytePos(30547), ctxt: #0 }, kind: "const", declare: false, decls: [VarDeclarator { span: Span { lo: BytePos(30510), hi: BytePos(30546), ctxt: #0 }, name: Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(30510), hi: BytePos(30514), ctxt: #5 }, sym: Atom('chat' type=inline), optional: false }, type_ann: None }), init: Some(Await(AwaitExpr { span: Span { lo: BytePos(30517), hi: BytePos(30546), ctxt: #0 }, arg: Call(CallExpr { span: Span { lo: BytePos(30523), hi: BytePos(30546), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(30523), hi: BytePos(30526), ctxt: #5 }, sym: Atom('get' type=static), optional: false })), args: [ExprOrSpread { spread: None, expr: Call(CallExpr { span: Span { lo: BytePos(30527), hi: BytePos(30545), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(30527), hi: BytePos(30541), ctxt: #1 }, sym: Atom('chatAtomFamily' type=dynamic), optional: false })), args: [ExprOrSpread { spread: None, expr: Ident(Ident { span: Span { lo: BytePos(30542), hi: BytePos(30544), ctxt: #3 }, sym: Atom('id' type=static), optional: false }) }], type_args: None }) }], type_args: None }) })), definite: false }] })), Decl(Var(VarDecl { span: Span { lo: BytePos(30554), hi: BytePos(30680), ctxt: #0 }, kind: "const", declare: false, decls: [VarDeclarator { span: Span { lo: BytePos(30560), hi: BytePos(30679), ctxt: #0 }, name: Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(30560), hi: BytePos(30567), ctxt: #5 }, sym: Atom('newChat' type=inline), optional: false }, type_ann: None }), init: Some(Object(ObjectLit { span: Span { lo: BytePos(30576), hi: BytePos(30679), ctxt: #0 }, props: [Spread(SpreadElement { dot3_token: Span { lo: BytePos(30586), hi: BytePos(30589), ctxt: #0 }, expr: Ident(Ident { span: Span { lo: BytePos(30589), hi: BytePos(30593), ctxt: #5 }, sym: Atom('chat' type=inline), optional: false }) }), Prop(KeyValue(KeyValueProp { key: Ident(Ident { span: Span { lo: BytePos(30603), hi: BytePos(30615), ctxt: #0 }, sym: Atom('startMessage' type=dynamic), optional: false }), value: Member(MemberExpr { span: Span { lo: BytePos(30617), hi: BytePos(30625), ctxt: #0 }, obj: Ident(Ident { span: Span { lo: BytePos(30617), hi: BytePos(30622), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }), prop: Computed(ComputedPropName { span: Span { lo: BytePos(30622), hi: BytePos(30625), ctxt: #0 }, expr: Lit(Num(Number { span: Span { lo: BytePos(30623), hi: BytePos(30624), ctxt: #0 }, value: 0.0, raw: Some("0") })) }) }) })), Prop(KeyValue(KeyValueProp { key: Ident(Ident { span: Span { lo: BytePos(30635), hi: BytePos(30645), ctxt: #0 }, sym: Atom('endMessage' type=dynamic), optional: false }), value: Member(MemberExpr { span: Span { lo: BytePos(30647), hi: BytePos(30670), ctxt: #0 }, obj: Ident(Ident { span: Span { lo: BytePos(30647), hi: BytePos(30652), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }), prop: Computed(ComputedPropName { span: Span { lo: BytePos(30652), hi: BytePos(30670), ctxt: #0 }, expr: Bin(BinExpr { span: Span { lo: BytePos(30653), hi: BytePos(30669), ctxt: #0 }, op: "-", left: Member(MemberExpr { span: Span { lo: BytePos(30653), hi: BytePos(30665), ctxt: #0 }, obj: Ident(Ident { span: Span { lo: BytePos(30653), hi: BytePos(30658), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }), prop: Ident(Ident { span: Span { lo: BytePos(30659), hi: BytePos(30665), ctxt: #0 }, sym: Atom('length' type=static), optional: false }) }), right: Lit(Num(Number { span: Span { lo: BytePos(30668), hi: BytePos(30669), ctxt: #0 }, value: 1.0, raw: Some("1") })) }) }) }) }))] })), definite: false }] })), Expr(ExprStmt { span: Span { lo: BytePos(30687), hi: BytePos(30720), ctxt: #0 }, expr: Call(CallExpr { span: Span { lo: BytePos(30687), hi: BytePos(30719), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(30687), hi: BytePos(30690), ctxt: #5 }, sym: Atom('set' type=static), optional: false })), args: [ExprOrSpread { spread: None, expr: Call(CallExpr { span: Span { lo: BytePos(30691), hi: BytePos(30709), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: Bytthread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/phuctm97/Projects/chatfriday/web/modules/client/message.ts")'

Caused by:
    0: failed to invoke `/Users/phuctm97/Projects/chatfriday/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm` as js transform plugin at /Users/phuctm97/Projects/chatfriday/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm
    1: RuntimeError: call stack exhausted
    2: stk_ovf', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.245.27/src/plugin.rs:228:14
error - ./modules/client/message.ts
Error: failed to process failed to invoke plugin: failed to invoke plugin on 'Some("/Users/phuctm97/Projects/chatfriday/web/modules/client/message.ts")'

Caused by:
    0: failed to invoke `/Users/phuctm97/Projects/chatfriday/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm` as js transform plugin at /Users/phuctm97/Projects/chatfriday/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm
    1: RuntimeError: call stack exhausted
    2: stk_ovf

I can't reopen.

Thisen commented 1 year ago

Thanks for looking into it @Thisen. Looks like the issue changed into something else:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: ExportDecl(ExportDecl { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, decl: Var(VarDecl { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, kind: "const", declare: false, decls: [VarDeclarator { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #1 }, name: Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #1 }, sym: Atom('messagesAtomFamiLy' type=dynamic), optional: false }, type_ann: None }), init: Some(Call(CallExpr { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, callee: Expr(Member(MemberExpr { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, obj: Member(MemberExpr { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, obj: Ident(Ident { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, sym: Atom('globalThis' type=dynamic), optional: false }), prop: Ident(Ident { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, sym: Atom('jotaiAtomCache' type=dynamic), optional: false }) }), prop: Ident(Ident { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, sym: Atom('get' type=static), optional: false }) })), args: [ExprOrSpread { spread: None, expr: Lit(Str(Str { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, value: Atom('/Users/phuctm97/Projects/chatfriday/web/modules/client/message.ts/messagesAtomFamiLy' type=dynamic), raw: None })) }, ExprOrSpread { spread: None, expr: Call(CallExpr { span: Span { lo: BytePos(11571), hi: BytePos(11970), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(11571), hi: BytePos(11575), ctxt: #1 }, sym: Atom('atom' type=inline), optional: false })), args: [ExprOrSpread { spread: None, expr: Arrow(ArrowExpr { span: Span { lo: BytePos(11641), hi: BytePos(11666), ctxt: #0 }, params: [Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(11642), hi: BytePos(11645), ctxt: #4 }, sym: Atom('get' type=static), optional: false }, type_ann: None })], body: Expr(Call(CallExpr { span: Span { lo: BytePos(11650), hi: BytePos(11666), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(11650), hi: BytePos(11653), ctxt: #4 }, sym: Atom('get' type=static), optional: false })), args: [ExprOrSpread { spread: None, expr: Ident(Ident { span: Span { lo: BytePos(11654), hi: BytePos(11665), ctxt: #3 }, sym: Atom('storageAtom' type=dynamic), optional: false }) }], type_args: None })), is_async: false, is_generator: false, type_params: None, return_type: None }) }, ExprOrSpread { spread: None, expr: Arrow(ArrowExpr { span: Span { lo: BytePos(11672), hi: BytePos(11966), ctxt: #0 }, params: [Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(11679), hi: BytePos(11682), ctxt: #5 }, sym: Atom('get' type=static), optional: false }, type_ann: None }), Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(11684), hi: BytePos(11687), ctxt: #5 }, sym: Atom('set' type=static), optional: false }, type_ann: None }), Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(11689), hi: BytePos(11694), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }, type_ann: None })], body: BlockStmt(BlockStmt { span: Span { lo: BytePos(11699), hi: BytePos(11966), ctxt: #0 }, stmts: [Expr(ExprStmt { span: Span { lo: BytePos(11707), hi: BytePos(11737), ctxt: #0 }, expr: Await(AwaitExpr { span: Span { lo: BytePos(11707), hi: BytePos(11736), ctxt: #0 }, arg: Call(CallExpr { span: Span { lo: BytePos(11713), hi: BytePos(11736), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(11713), hi: BytePos(11716), ctxt: #5 }, sym: Atom('set' type=static), optional: false })), args: [ExprOrSpread { spread: None, expr: Ident(Ident { span: Span { lo: BytePos(11717), hi: BytePos(11728), ctxt: #3 }, sym: Atom('storageAtom' type=dynamic), optional: false }) }, ExprOrSpread { spread: None, expr: Ident(Ident { span: Span { lo: BytePos(11730), hi: BytePos(11735), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }) }], type_args: None }) }) }), Decl(Var(VarDecl { span: Span { lo: BytePos(11744), hi: BytePos(11787), ctxt: #0 }, kind: "const", declare: false, decls: [VarDeclarator { span: Span { lo: BytePos(11750), hi: BytePos(11786), ctxt: #0 }, name: Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(11750), hi: BytePos(11754), ctxt: #5 }, sym: Atom('chat' type=inline), optional: false }, type_ann: None }), init: Some(Await(AwaitExpr { span: Span { lo: BytePos(11757), hi: BytePos(11786), ctxt: #0 }, arg: Call(CallExpr { span: Span { lo: BytePos(11763), hi: BytePos(11786), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(11763), hi: BytePos(11766), ctxt: #5 }, sym: Atom('get' type=static), optional: false })), args: [ExprOrSpread { spread: None, expr: Call(CallExpr { span: Span { lo: BytePos(11767), hi: BytePos(11785), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(11767), hi: BytePos(11781), ctxt: #1 }, sym: Atom('chatAtomFamily' type=dynamic), optional: false })), args: [ExprOrSpread { spread: None, expr: Ident(Ident { span: Span { lo: BytePos(11782), hi: BytePos(11784), ctxt: #3 }, sym: Atom('id' type=static), optional: false }) }], type_args: None }) }], type_args: None }) })), definite: false }] })), Decl(Var(VarDecl { span: Span { lo: BytePos(11794), hi: BytePos(11920), ctxt: #0 }, kind: "const", declare: false, decls: [VarDeclarator { span: Span { lo: BytePos(11800), hi: BytePos(11919), ctxt: #0 }, name: Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(11800), hi: BytePos(11807), ctxt: #5 }, sym: Atom('newChat' type=inline), optional: false }, type_ann: None }), init: Some(Object(ObjectLit { span: Span { lo: BytePos(11816), hi: BytePos(11919), ctxt: #0 }, props: [Spread(SpreadElement { dot3_token: Span { lo: BytePos(11826), hi: BytePos(11829), ctxt: #0 }, expr: Ident(Ident { span: Span { lo: BytePos(11829), hi: BytePos(11833), ctxt: #5 }, sym: Atom('chat' type=inline), optional: false }) }), Prop(KeyValue(KeyValueProp { key: Ident(Ident { span: Span { lo: BytePos(11843), hi: BytePos(11855), ctxt: #0 }, sym: Atom('startMessage' type=dynamic), optional: false }), value: Member(MemberExpr { span: Span { lo: BytePos(11857), hi: BytePos(11865), ctxt: #0 }, obj: Ident(Ident { span: Span { lo: BytePos(11857), hi: BytePos(11862), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }), prop: Computed(ComputedPropName { span: Span { lo: BytePos(11862), hi: BytePos(11865), ctxt: #0 }, expr: Lit(Num(Number { span: Span { lo: BytePos(11863), hi: BytePos(11864), ctxt: #0 }, value: 0.0, raw: Some("0") })) }) }) })), Prop(KeyValue(KeyValueProp { key: Ident(Ident { span: Span { lo: BytePos(11875), hi: BytePos(11885), ctxt: #0 }, sym: Atom('endMessage' type=dynamic), optional: false }), value: Member(MemberExpr { span: Span { lo: BytePos(11887), hi: BytePos(11910), ctxt: #0 }, obj: Ident(Ident { span: Span { lo: BytePos(11887), hi: BytePos(11892), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }), prop: Computed(ComputedPropName { span: Span { lo: BytePos(11892), hi: BytePos(11910), ctxt: #0 }, expr: Bin(BinExpr { span: Span { lo: BytePos(11893), hi: BytePos(11909), ctxt: #0 }, op: "-", left: Member(MemberExpr { span: Span { lo: BytePos(11893), hi: BytePos(11905), ctxt: #0 }, obj: Ident(Ident { span: Span { lo: BytePos(11893), hi: BytePos(11898), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }), prop: Ident(Ident { span: Span { lo: BytePos(11899), hi: BytePos(11905), ctxt: #0 }, sym: Atom('length' type=static), optional: false }) }), right: Lit(Num(Number { span: Span { lo: BytePos(11908), hi: BytePos(11909), ctxt: #0 }, value: 1.0, raw: Some("1") })) }) }) }) }))] })), definite: false }] })), Expr(ExprStmt { span: Span { lo: BytePos(11927), hi: BytePos(11960), ctxt: #0 }, expr: Call(CallExpr { span: Span { lo: BytePos(11927), hi: BytePos(11959), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(11927), hi: BytePos(11930), ctxt: #5 }, sym: Atom('set' type=static), optional: false })), args: [ExprOrSpread { spread: None, expr: Call(CallExpr { span: Span { lo: BytePos(11931), hi: BytePos(11949), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: Bytthread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/phuctm97/Projects/chatfriday/web/modules/client/message.ts")'

Caused by:
    0: failed to invoke `/Users/phuctm97/Projects/chatfriday/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm` as js transform plugin at /Users/phuctm97/Projects/chatfriday/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm
    1: RuntimeError: call stack exhausted
    2: stk_ovf', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.245.27/src/plugin.rs:228:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: ExportDecl(ExportDecl { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, decl: Var(VarDecl { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, kind: "const", declare: false, decls: [VarDeclarator { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #1 }, name: Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #1 }, sym: Atom('messagesAtomFamiLy' type=dynamic), optional: false }, type_ann: None }), init: Some(Call(CallExpr { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, callee: Expr(Member(MemberExpr { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, obj: Member(MemberExpr { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, obj: Ident(Ident { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, sym: Atom('globalThis' type=dynamic), optional: false }), prop: Ident(Ident { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, sym: Atom('jotaiAtomCache' type=dynamic), optional: false }) }), prop: Ident(Ident { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, sym: Atom('get' type=static), optional: false }) })), args: [ExprOrSpread { spread: None, expr: Lit(Str(Str { span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }, value: Atom('/Users/phuctm97/Projects/chatfriday/web/modules/client/message.ts/messagesAtomFamiLy' type=dynamic), raw: None })) }, ExprOrSpread { spread: None, expr: Call(CallExpr { span: Span { lo: BytePos(30331), hi: BytePos(30730), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(30331), hi: BytePos(30335), ctxt: #1 }, sym: Atom('atom' type=inline), optional: false })), args: [ExprOrSpread { spread: None, expr: Arrow(ArrowExpr { span: Span { lo: BytePos(30401), hi: BytePos(30426), ctxt: #0 }, params: [Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(30402), hi: BytePos(30405), ctxt: #4 }, sym: Atom('get' type=static), optional: false }, type_ann: None })], body: Expr(Call(CallExpr { span: Span { lo: BytePos(30410), hi: BytePos(30426), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(30410), hi: BytePos(30413), ctxt: #4 }, sym: Atom('get' type=static), optional: false })), args: [ExprOrSpread { spread: None, expr: Ident(Ident { span: Span { lo: BytePos(30414), hi: BytePos(30425), ctxt: #3 }, sym: Atom('storageAtom' type=dynamic), optional: false }) }], type_args: None })), is_async: false, is_generator: false, type_params: None, return_type: None }) }, ExprOrSpread { spread: None, expr: Arrow(ArrowExpr { span: Span { lo: BytePos(30432), hi: BytePos(30726), ctxt: #0 }, params: [Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(30439), hi: BytePos(30442), ctxt: #5 }, sym: Atom('get' type=static), optional: false }, type_ann: None }), Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(30444), hi: BytePos(30447), ctxt: #5 }, sym: Atom('set' type=static), optional: false }, type_ann: None }), Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(30449), hi: BytePos(30454), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }, type_ann: None })], body: BlockStmt(BlockStmt { span: Span { lo: BytePos(30459), hi: BytePos(30726), ctxt: #0 }, stmts: [Expr(ExprStmt { span: Span { lo: BytePos(30467), hi: BytePos(30497), ctxt: #0 }, expr: Await(AwaitExpr { span: Span { lo: BytePos(30467), hi: BytePos(30496), ctxt: #0 }, arg: Call(CallExpr { span: Span { lo: BytePos(30473), hi: BytePos(30496), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(30473), hi: BytePos(30476), ctxt: #5 }, sym: Atom('set' type=static), optional: false })), args: [ExprOrSpread { spread: None, expr: Ident(Ident { span: Span { lo: BytePos(30477), hi: BytePos(30488), ctxt: #3 }, sym: Atom('storageAtom' type=dynamic), optional: false }) }, ExprOrSpread { spread: None, expr: Ident(Ident { span: Span { lo: BytePos(30490), hi: BytePos(30495), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }) }], type_args: None }) }) }), Decl(Var(VarDecl { span: Span { lo: BytePos(30504), hi: BytePos(30547), ctxt: #0 }, kind: "const", declare: false, decls: [VarDeclarator { span: Span { lo: BytePos(30510), hi: BytePos(30546), ctxt: #0 }, name: Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(30510), hi: BytePos(30514), ctxt: #5 }, sym: Atom('chat' type=inline), optional: false }, type_ann: None }), init: Some(Await(AwaitExpr { span: Span { lo: BytePos(30517), hi: BytePos(30546), ctxt: #0 }, arg: Call(CallExpr { span: Span { lo: BytePos(30523), hi: BytePos(30546), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(30523), hi: BytePos(30526), ctxt: #5 }, sym: Atom('get' type=static), optional: false })), args: [ExprOrSpread { spread: None, expr: Call(CallExpr { span: Span { lo: BytePos(30527), hi: BytePos(30545), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(30527), hi: BytePos(30541), ctxt: #1 }, sym: Atom('chatAtomFamily' type=dynamic), optional: false })), args: [ExprOrSpread { spread: None, expr: Ident(Ident { span: Span { lo: BytePos(30542), hi: BytePos(30544), ctxt: #3 }, sym: Atom('id' type=static), optional: false }) }], type_args: None }) }], type_args: None }) })), definite: false }] })), Decl(Var(VarDecl { span: Span { lo: BytePos(30554), hi: BytePos(30680), ctxt: #0 }, kind: "const", declare: false, decls: [VarDeclarator { span: Span { lo: BytePos(30560), hi: BytePos(30679), ctxt: #0 }, name: Ident(BindingIdent { id: Ident { span: Span { lo: BytePos(30560), hi: BytePos(30567), ctxt: #5 }, sym: Atom('newChat' type=inline), optional: false }, type_ann: None }), init: Some(Object(ObjectLit { span: Span { lo: BytePos(30576), hi: BytePos(30679), ctxt: #0 }, props: [Spread(SpreadElement { dot3_token: Span { lo: BytePos(30586), hi: BytePos(30589), ctxt: #0 }, expr: Ident(Ident { span: Span { lo: BytePos(30589), hi: BytePos(30593), ctxt: #5 }, sym: Atom('chat' type=inline), optional: false }) }), Prop(KeyValue(KeyValueProp { key: Ident(Ident { span: Span { lo: BytePos(30603), hi: BytePos(30615), ctxt: #0 }, sym: Atom('startMessage' type=dynamic), optional: false }), value: Member(MemberExpr { span: Span { lo: BytePos(30617), hi: BytePos(30625), ctxt: #0 }, obj: Ident(Ident { span: Span { lo: BytePos(30617), hi: BytePos(30622), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }), prop: Computed(ComputedPropName { span: Span { lo: BytePos(30622), hi: BytePos(30625), ctxt: #0 }, expr: Lit(Num(Number { span: Span { lo: BytePos(30623), hi: BytePos(30624), ctxt: #0 }, value: 0.0, raw: Some("0") })) }) }) })), Prop(KeyValue(KeyValueProp { key: Ident(Ident { span: Span { lo: BytePos(30635), hi: BytePos(30645), ctxt: #0 }, sym: Atom('endMessage' type=dynamic), optional: false }), value: Member(MemberExpr { span: Span { lo: BytePos(30647), hi: BytePos(30670), ctxt: #0 }, obj: Ident(Ident { span: Span { lo: BytePos(30647), hi: BytePos(30652), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }), prop: Computed(ComputedPropName { span: Span { lo: BytePos(30652), hi: BytePos(30670), ctxt: #0 }, expr: Bin(BinExpr { span: Span { lo: BytePos(30653), hi: BytePos(30669), ctxt: #0 }, op: "-", left: Member(MemberExpr { span: Span { lo: BytePos(30653), hi: BytePos(30665), ctxt: #0 }, obj: Ident(Ident { span: Span { lo: BytePos(30653), hi: BytePos(30658), ctxt: #5 }, sym: Atom('value' type=inline), optional: false }), prop: Ident(Ident { span: Span { lo: BytePos(30659), hi: BytePos(30665), ctxt: #0 }, sym: Atom('length' type=static), optional: false }) }), right: Lit(Num(Number { span: Span { lo: BytePos(30668), hi: BytePos(30669), ctxt: #0 }, value: 1.0, raw: Some("1") })) }) }) }) }))] })), definite: false }] })), Expr(ExprStmt { span: Span { lo: BytePos(30687), hi: BytePos(30720), ctxt: #0 }, expr: Call(CallExpr { span: Span { lo: BytePos(30687), hi: BytePos(30719), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: BytePos(30687), hi: BytePos(30690), ctxt: #5 }, sym: Atom('set' type=static), optional: false })), args: [ExprOrSpread { spread: None, expr: Call(CallExpr { span: Span { lo: BytePos(30691), hi: BytePos(30709), ctxt: #0 }, callee: Expr(Ident(Ident { span: Span { lo: Bytthread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/phuctm97/Projects/chatfriday/web/modules/client/message.ts")'

Caused by:
    0: failed to invoke `/Users/phuctm97/Projects/chatfriday/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm` as js transform plugin at /Users/phuctm97/Projects/chatfriday/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm
    1: RuntimeError: call stack exhausted
    2: stk_ovf', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.245.27/src/plugin.rs:228:14
error - ./modules/client/message.ts
Error: failed to process failed to invoke plugin: failed to invoke plugin on 'Some("/Users/phuctm97/Projects/chatfriday/web/modules/client/message.ts")'

Caused by:
    0: failed to invoke `/Users/phuctm97/Projects/chatfriday/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm` as js transform plugin at /Users/phuctm97/Projects/chatfriday/web/node_modules/@swc-jotai/react-refresh/swc_jotai_react_refresh.wasm
    1: RuntimeError: call stack exhausted
    2: stk_ovf

I can't reopen.

Can you try latest Next.js 13.2.4?

If that doesn't work, please provide a reproduction.

firede commented 1 year ago

@Thisen Thanks for working on this. I got the same issue. Use the codesandbox in the README, upgrade next to the latest version, and it will reproduce.

CleanShot 2023-03-11 at 19 25 39@2x
drMonro commented 1 year ago

Got the same problem. Next 13.2.4

Thisen commented 1 year ago

An update: I'm actively working on it, but I'm having a hard time troubleshooting the issue. I'll keep you all posted.

Thisen commented 1 year ago

I believe we're experiencing these issues:

phuctm97 commented 1 year ago

I believe we're experiencing these issues:

I have the exact 2 issues, still can't use the plugins at the moment. Looking forward to the update!

sari-shipt commented 1 year ago

Same issue issue. Looking forward to the fix!

sari-shipt commented 1 year ago

Issue still persists with next 13.3.0 and debug-label 0.0.9 and react-refresh 0.0.7

Thisen commented 1 year ago

Issue still persists with next 13.3.0 and debug-label 0.0.9 and react-refresh 0.0.7

Looks like it's still a reported issue: https://github.com/vercel/next.js/issues/46989

loukamb commented 1 year ago

Also having this problem. The Nextjs issue just got patched however, so we just need to update the plugin and all's good.

ornakash commented 1 year ago

Same issue here next@13.3.0

sari-shipt commented 1 year ago

@Thisen - New error after updated swc/core to latest 1.3.52 and next to 13.3.0

image
aretrace commented 1 year ago

Same issue for next@13.3.0

tomas-c commented 1 year ago

Updating swc_core to 0.75.23 and Next.js to 13.3.1 has fixed it for my own plugin that was having a similar issue

yangfei4913438 commented 1 year ago

same error here on nextjs 13.3.1

Thisen commented 1 year ago

This should be fixed in latest versions hopefully!

adambarito commented 1 year ago

Updating to Next 13.3.1 & @swc-jotai/react-refresh v0.0.8 is giving me a new error:

thread '<unnamed>' panicked at 'assertion failed: prev.start > max', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasmer-compiler-3.2.0-beta.2/src/engine/trap/frame_info.rs:224:9

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error - ../../node_modules/next/dist/shared/lib/router/router.js

Error: failed to process

Import trace for requested module:
../../node_modules/next/dist/shared/lib/router/router.js

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: PoisonError { .. }', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasmer-compiler-3.2.0-beta.2/src/engine/trap/frame_info.rs:220:39

error - ../../node_modules/next/dist/shared/lib/router/router.js
Error: failed to process called `Result::unwrap()` on an `Err` value: PoisonError { .. }

Import trace for requested module:
../../node_modules/next/dist/shared/lib/router/router.js

As far as I can tell, @swc-jotai/debug-label v0.0.10 does not throw any errors.

fabio-nettis commented 1 year ago

Still happens to me using Next.js v13.4.1, tried pretty much everything. I'm seeing following error in the console output:

.thread '<unnamed>' panicked at 'assertion failed: prev.start > max', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasmer-compiler-3.2.1/src/engine/trap/frame_info.rs:224:9

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: PoisonError { .. }', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasmer-compiler-3.2.1/src/engine/trap/frame_info.rs:220:39

Would really appreciate if you could take a look at this. Thank you for the effort.

ornakash commented 1 year ago

I created a new issue because this one was closed. Please add a comment here - https://github.com/pmndrs/swc-jotai/issues/13

usercao commented 1 year ago
module.exports = {
  experimental: {
    swcPlugins: [['@swc-jotai/react-refresh', {}]],
  },
}

The issue still exists in version v13.4.12, Should we reopen this issue?

tylervick commented 1 year ago
module.exports = {
  experimental: {
    swcPlugins: [['@swc-jotai/react-refresh', {}]],
  },
}

The issue still exists in version v13.4.12, Should we reopen this issue?

I can confirm the same issue on next@13.4.19 and @swc-jotai/react-refresh@0.1.0. @Thisen could we reopen this please?

rzru commented 7 months ago

@Thisen can confirm the same for "next": "13.4.4" ;( +1 to reopen the issue

yoel3imari commented 6 months ago

install SWC

just installed swc using: npm i -g @swc/cli @swc/corg that fixed the problem