Rspack/Rsbuild: `@workflow/swc-plugin` can't run in `builtin:swc-loader`. Open to an `@workflow/rsbuild`?

Aperta
#4,447 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust, typescript

Direzione di ricerca

Start by running the documented npm install and npx rspack build reproduction, then read the @workflow/next/loader entry point. Review packages/builders/src/vercel-build-output-api.ts and the related Nitro and Astro builder files to understand the proposed integration boundaries. Done means an agreed Rsbuild integration or thin third-party path that supports the reported build and preserves existing .vercel/output/config.json content.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

@workflow/swc-plugin fails in Rspack's builtin:swc-loader, so Rsbuild/Rspack apps have no supported way to use Workflow.

Repro
npm i -D @rspack/[email protected] @rspack/[email protected] @workflow/[email protected]
// src/index.ts
export async function add(a: number, b: number) {
  'use step';
  return a + b;
}
// rspack.config.mjs
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);

export default {
  target: 'node',
  entry: './src/index.ts',
  module: {
    rules: [{
      test: /\.ts$/,
      loader: 'builtin:swc-loader',
      options: { jsc: {
        parser: { syntax: 'typescript' },
        experimental: { plugins: [[require.resolve('@workflow/swc-plugin'), { mode: 'step' }]] },
      } },
    }],
  },
};

Run npx rspack build.

Expected: the step transform runs.
Actual: failed to invoke plugin ... Failed to deserialize program received from host. The plugin pins swc_core 49 (Cargo.toml); Rspack 2.2 embeds swc_core 79.

Versions

@rspack/core 2.2.7; @workflow/swc-plugin 4.1.3 and 5.0.0-beta.7 (still swc_core 49 on main).

Workaround

@workflow/next/loader works as a plain Rspack JS loader.

Ask

Would you take an @workflow/rsbuild package? We have one working on workflow 4.8 (JS loader, BaseBuilder subclass, dev middleware) and can contribute it. If you'd rather keep it out of tree, two changes would keep a third-party plugin thin:

  1. Export the loader from a bundler-neutral path, e.g. @workflow/builders/loader.
  2. Have VercelBuildOutputAPIBuilder merge into an existing .vercel/output/config.json instead of overwriting it (vercel-build-output-api.ts#L111-L126). Nitro and Astro each re-merge it today (nitro, astro).
Lingua principale
TypeScript
Stelle
2.5k
Fork
401
Merge medio
1g 21h
PR unite (30g)
201

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vercel/workflow

Tutte le issue di vercel/workflow

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.