From 22f41626e9b0c3fdf1acecfc145fc75b39076f7c Mon Sep 17 00:00:00 2001 From: Taras Mankovski Date: Wed, 10 Jun 2026 12:02:22 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Fix=20@effectionx/inline=20wasm?= =?UTF-8?q?=20plugin=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The swc-plugin-inline release build failed to link on current Rust: `rust-lld: undefined symbol: __emit_diagnostics` (and the other SWC host-ABI `__*_proxy` imports). Newer wasm-ld no longer leaves these undefined symbols as imports by default, so the link needs `-C link-arg=--allow-undefined`. The cargo config that carries the plugin's rustflags lived at inline/swc/.cargo/config.toml, but `build:bundle` runs cargo from inline/ (`--manifest-path swc/Cargo.toml`) and cargo discovers config relative to the working directory — so those rustflags (including the pre-existing `--cfg=swc_ast_unknown`) were silently ignored in CI. Move the config to inline/.cargo/config.toml so it is actually applied, and add the `--allow-undefined` link arg. Unblocks CI on PR #218. --- inline/.cargo/config.toml | 15 +++++++++++++++ inline/swc/.cargo/config.toml | 5 ----- 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 inline/.cargo/config.toml delete mode 100644 inline/swc/.cargo/config.toml diff --git a/inline/.cargo/config.toml b/inline/.cargo/config.toml new file mode 100644 index 00000000..1e83da60 --- /dev/null +++ b/inline/.cargo/config.toml @@ -0,0 +1,15 @@ +# This file lives at the package root (inline/.cargo), not next to the crate +# (inline/swc), because `build:bundle` runs cargo from inline/ with +# `--manifest-path swc/Cargo.toml`, and cargo discovers config relative to the +# working directory. Placed under swc/ these rustflags would be silently ignored. +# +# Required for backward compatibility with @swc/core >= 1.15.0. +# Enables the Unknown variant on AST enums so the plugin can handle +# node types introduced in newer SWC versions. +# +# --allow-undefined keeps the SWC host-ABI symbols (__emit_diagnostics, +# *_proxy, __set_transform_result, …) as wasm imports resolved by the plugin +# host at runtime. Newer rust-lld/wasm-ld no longer leaves undefined symbols as +# imports by default, so without this the release link fails for the plugin. +[target.'cfg(target_arch = "wasm32")'] +rustflags = ["--cfg=swc_ast_unknown", "-C", "link-arg=--allow-undefined"] diff --git a/inline/swc/.cargo/config.toml b/inline/swc/.cargo/config.toml deleted file mode 100644 index 30b5c182..00000000 --- a/inline/swc/.cargo/config.toml +++ /dev/null @@ -1,5 +0,0 @@ -# Required for backward compatibility with @swc/core >= 1.15.0. -# Enables the Unknown variant on AST enums so the plugin can handle -# node types introduced in newer SWC versions. -[target.'cfg(target_arch = "wasm32")'] -rustflags = ["--cfg=swc_ast_unknown"]