swc-project/swc · warning

Currently @swc/wasm does not support plugins, plugin transfo

Error message

Currently @swc/wasm does not support plugins, plugin transform will be skipped. Refer https://github.com/swc-project/swc/issues/3934 for the details.

What it means

Emitted by the swc crate when it is compiled for the wasm32 target (i.e. @swc/wasm) with the plugin feature enabled: wasm-in-wasm plugin execution is not supported in that build, so SWC warns and substitutes a noop pass. Any configured jsc.experimental.plugins are silently skipped and the transform runs without them.

Source

Thrown at crates/swc/src/config/mod.rs:857

                Box::new(crate::plugin::plugins(
                    experimental.plugins,
                    experimental.plugin_env_vars,
                    transform_metadata_context,
                    comments.cloned(),
                    cm.clone(),
                    unresolved_mark,
                    plugin_runtime,
                ))
            }

            // Native runtime plugin target, based on assumption we have
            // 1. no filesystem access, loading binary / cache management should be
            // performed externally
            // 2. native runtime compiles & execute wasm (i.e v8 on node, chrome)
            #[cfg(all(feature = "plugin", target_arch = "wasm32"))]
            {
                handler.warn(
                    "Currently @swc/wasm does not support plugins, plugin transform will be \
                     skipped. Refer https://github.com/swc-project/swc/issues/3934 for the details.",
                );

                Box::new(noop_pass())
            }
        };

        #[cfg(not(feature = "plugin"))]
        let plugin_transforms: Box<dyn Pass> = {
            if experimental.plugins.is_some() {
                handler.warn(
                    "Plugin is not supported with current @swc/core. Plugin transform will be \
                     skipped.",
                );
            }
            Box::new(noop_pass())
        };

View on GitHub (pinned to 5176682b65)

Solutions

  1. Fix the native @swc/core installation (reinstall with optional platform deps) so plugins actually run.
  2. Remove plugins from the config when you must stay on @swc/wasm, and replace their behavior with config-driven transforms.
  3. Fail fast yourself: detect the wasm binding before transform and throw instead of silently shipping untransformed output.
  4. Track swc-project/swc#3934 for wasm-target plugin support.

Example fix

// .swcrc before (plugins silently ignored under @swc/wasm)
{
  "jsc": {
    "experimental": { "plugins": [["./my_plugin.wasm", {}]] }
  }
}

// after (when running on wasm, express the transform with supported config)
{
  "jsc": {
    "experimental": { "plugins": [] },
    "transform": { "optimizer": { "globals": { "vars": { "__DEBUG__": "false" } } } }
  }
}
Defensive patterns

Strategy: validation

Validate before calling

// In Rust builds targeting wasm32, reject plugin configs loudly instead of
// accepting a silent noop pass.
#[cfg(target_arch = "wasm32")]
fn reject_plugins(experimental: &Option<ExperimentalOptions>) -> anyhow::Result<()> {
    if let Some(e) = experimental {
        if e.plugins.is_some() {
            anyhow::bail!("plugins are not supported on wasm32 builds; remove jsc.experimental.plugins");
        }
    }
    Ok(())
}

Type guard

fn pluginRuntimeSupported(): boolean {
  // The warning only fires on wasm32 builds of the swc crate, i.e. @swc/wasm.
  // Treat 'native binding absent' as 'plugins unsupported'.
  const os = require('os') as typeof import('os');
  const { optionalDependencies } = require('@swc/core/package.json');
  const tri = `@swc/core-${os.platform()}-${os.arch()}`;
  return Object.keys(optionalDependencies ?? {}).some(
    (d) => d.startsWith(tri) && (() => { try { require.resolve(d); return true; } catch { return false; } })()
  );
}

Prevention

When it happens

Trigger: Running @swc/wasm (browser/wasm environments, or as the automatic fallback when native bindings fail to install) with jsc.experimental.plugins or plugin_paths configured in the swc config.

Common situations: Native @swc/core install failed so the JS layer fell back to @swc/wasm while the config still lists wasm plugins; CI/browser environments using @swc/wasm directly; users confused why plugin transforms have no effect.

Related errors


AI-assisted analysis of swc-project/swc@5176682b65 (2026-08-17). Data as JSON: /api/errors/10dc2dd029ce2f33. Report an issue: GitHub.