sopranopillow / fluentui-nextjs-appdir-plugin

Plugin for Fluent UI to work correctly with NextJS app router. This plugin essentially adds the "use client" directive to all Fluent UI files.
https://www.npmjs.com/package/fluentui-next-appdir-directive
11 stars 2 forks source link

Plugin not work with the latest next.js version #1

Closed julianortlieb closed 5 months ago

julianortlieb commented 6 months ago

The plugin don't work with the latest version of next.js.

    "fluentui-next-appdir-directive": "^0.1.5",
    "next": "^14.2.3",

Only with downgrade to 14.1.1 the plugin works.

Here is my config.

/** @type {import('next').NextConfig} */
const nextConfig = {
    experimental: {
        swcPlugins: [
            ['fluentui-next-appdir-directive', {
                paths: [
                    '@griffel',
                    '@fluentui'
                ]
            }],
        ],
    },
};

module.exports = nextConfig;

Exception

Caused by:
    0: failed to invoke `C:\Users\test\source\git\template-node\templates\next\node_modules\fluentui-next-appdir-directive\target\wasm32-wasi\release\fluentui_next_appdir_directive.wasm` as js transform plugin at C:\Users\test\source\git\template-node\templates\next\node_modules\fluentui-next-appdir-directive\target\wasm32-wasi\release\fluentui_next_appdir_directive.wasm
    1: failed to run Wasm plugin transform. Please ensure the version of `swc_core` used by the plugin is compatible with the host runtime. See https://swc.rs/docs/plugin/selecting-swc-corefor compatibility information. If you are an author of the plugin, please update `swc_core` to the compatible version.
    2: RuntimeError: unreachable
           at __rust_start_panic (<module>[1642]:0x1b26ea)
           at rust_panic (<module>[1633]:0x1b24a2)
           at std::panicking::rust_panic_with_hook::h639672e96e0f2421 (<module>[1632]:0x1b23d5)
           at std::panicking::begin_panic_handler::{{closure}}::he2feed3b05783a82 (<module>[1620]:0x1b178d)
           at std::sys_common::backtrace::__rust_end_short_backtrace::h2453fabad70b604e (<module>[1619]:0x1b16b0)
           at rust_begin_unwind (<module>[1627]:0x1b1d8c)
           at core::panicking::panic_fmt::h8d812bd208f205dc (<module>[1715]:0x1b7776)
           at core::result::unwrap_failed::h0c9b525dd5a26387 (<module>[1747]:0x1bdbda)
           at rkyv::impls::core::<impl rkyv::DeserializeUnsized<[U],D> for [T]>::deserialize_unsized::h80434561e8729f7e (<module>[385]:0x90340)
           at swc_ecma_ast::expr::_::<impl rkyv::Deserialize<swc_ecma_ast::expr::Expr,__D> for <swc_ecma_ast::expr::Expr as rkyv::Archive>::Archived>::deserialize::h7c9b6efa19d63304 (<module>[42]:0xbae2)
           at swc_ecma_ast::stmt::_::<impl rkyv::Deserialize<swc_ecma_ast::stmt::Stmt,__D> for <swc_ecma_ast::stmt::Stmt as rkyv::Archive>::Archived>::deserialize::heba46add8027e39a (<module>[77]:0x20304)
           at rkyv::impls::core::<impl rkyv::DeserializeUnsized<[U],D> for [T]>::deserialize_unsized::hae0c913f745abcd0 (<module>[26]:0x5c20)
           at __transform_plugin_process_impl (<module>[795]:0x126867)
           at __transform_plugin_process_impl.command_export (<module>[1813]:0x1c2938)
thread '<unnamed>' panicked at C:\Users\Administrator\.cargo\registry\src\index.crates.io-6f17d22bba15001f\swc-0.273.24\src\plugin.rs:166:14:
failed to invoke plugin: failed to invoke plugin on 'Some("C:\\Users\\test\\source\\git\\template-node\\templates\\next\\node_modules\\next\\dist\\pages\\_error.js")'

Caused by:
    0: failed to invoke `C:\Users\test\source\git\template-node\templates\next\node_modules\fluentui-next-appdir-directive\target\wasm32-wasi\release\fluentui_next_appdir_directive.wasm` as js transform plugin at C:\Users\test\source\git\template-node\templates\next\node_modules\fluentui-next-appdir-directive\target\wasm32-wasi\release\fluentui_next_appdir_directive.wasm
    1: failed to run Wasm plugin transform. Please ensure the version of `swc_core` used by the plugin is compatible with the host runtime. See https://swc.rs/docs/plugin/selecting-swc-corefor compatibility information. If you are an author of the plugin, please update `swc_core` to the compatible version.
    2: RuntimeError: unreachable
           at __rust_start_panic (<module>[1642]:0x1b26ea)
           at rust_panic (<module>[1633]:0x1b24a2)
           at std::panicking::rust_panic_with_hook::h639672e96e0f2421 (<module>[1632]:0x1b23d5)
           at std::panicking::begin_panic_handler::{{closure}}::he2feed3b05783a82 (<module>[1620]:0x1b178d)
           at std::sys_common::backtrace::__rust_end_short_backtrace::h2453fabad70b604e (<module>[1619]:0x1b16b0)
           at rust_begin_unwind (<module>[1627]:0x1b1d8c)
           at core::panicking::panic_fmt::h8d812bd208f205dc (<module>[1715]:0x1b7776)
           at core::result::unwrap_failed::h0c9b525dd5a26387 (<module>[1747]:0x1bdbda)
           at rkyv::impls::core::<impl rkyv::DeserializeUnsized<[U],D> for [T]>::deserialize_unsized::h80434561e8729f7e (<module>[385]:0x90340)
           at swc_ecma_ast::expr::_::<impl rkyv::Deserialize<swc_ecma_ast::expr::Expr,__D> for <swc_ecma_ast::expr::Expr as rkyv::Archive>::Archived>::deserialize::h7c9b6efa19d63304 (<module>[42]:0xbae2)
           at swc_ecma_ast::stmt::_::<impl rkyv::Deserialize<swc_ecma_ast::stmt::Stmt,__D> for <swc_ecma_ast::stmt::Stmt as rkyv::Archive>::Archived>::deserialize::heba46add8027e39a (<module>[77]:0x20304)
           at rkyv::impls::core::<impl rkyv::DeserializeUnsized<[U],D> for [T]>::deserialize_unsized::hae0c913f745abcd0 (<module>[26]:0x5c20)
           at __transform_plugin_process_impl (<module>[795]:0x126867)
           at __transform_plugin_process_impl.command_export (<module>[1813]:0x1c2938)
thread '<unnamed>' panicked at /home/estebanmu-dev/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rkyv-0.7.42/src/impls/core/mod.rs:266:67:
called `Result::unwrap()` on an `Err` value: LayoutError
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at C:\Users\Administrator\.cargo\registry\src\index.crates.io-6f17d22bba15001f\swc-0.273.24\src\plugin.rs:166thread ':14<unnamed>:
' panicked at failed to invoke plugin: failed to invoke plugin on 'Some("C:\\Users\\test\\source\\git\\template-node\\templates\\next\\node_modules\\next\\dist\\pages\\_app.js")'