@mbsks/rspfx-plugin
v0.0.15
Published
RSPFX bundler plugins: RspfxPlugin (Rspack/Webpack-compatible), rspfxVite (Vite) and rspfxRsbuild (Rsbuild) carrying the single project config object
Downloads
105
Readme
@mbsks/rspfx-plugin
Bundler plugins for RSPFX — an SPFx-compatible build toolchain. Replaces Heft + webpack + gulp. Vite (default) · Rsbuild · Rspack — one config, three bundlers.
Provides the three thin adapters over a single compilation kernel: Rspack (RSpfxPlugin), Vite (rspfxVite), Rsbuild (rspfxRsbuild). All read the same RSPFX_PLUGIN_MARKER project config and share manifest / sppkg / dev-runtime.
Install
npm i @mbsks/rspfx-plugin
# peer: @rspack/core for Rspack, vite for Vite, @rsbuild/core for Rsbuild (optional)Usage
Rspack — rspack.config.ts:
import { RSpfxPlugin, defineConfig } from '@mbsks/rspfx-plugin';
export default defineConfig({
plugins: [new RSpfxPlugin({ framework: 'react', spfxVersion: '1.23' })]
});Vite — vite.config.ts:
import { defineConfig } from 'vite';
import { rspfxVite, defineConfig as defineRspfx } from '@mbsks/rspfx-plugin';
export default defineConfig({
plugins: [rspfxVite(defineRspfx({ framework: 'react', spfxVersion: '1.23' }))]
});Rsbuild — rsbuild.config.ts:
import { defineConfig } from '@rsbuild/core';
import { rspfxRsbuild, defineConfig as defineRspfx } from '@mbsks/rspfx-plugin';
export default defineConfig({
plugins: [rspfxRsbuild(defineRspfx({ framework: 'react', spfxVersion: '1.23' }))]
});rspfx new / rspfx migrate generates this for you — no manual bundler config needed for standard SPFx layouts (src/webparts/*/, config/).
API
RSpfxPlugin— Rspack/Webpack-compatible pluginrspfxVite(opts)— Vite plugin (ViteRspfxPlugin)rspfxRsbuild(opts)— Rsbuild plugin (RsbuildRspfxPlugin)createKernel(opts)— single compilation kernel (shared by all three adapters)rspfxResolve— resolve helpers- Re-exports:
defineConfig,resolveConfig,RSPFX_PLUGIN_MARKER,RSPFX_PLUGIN_OPTIONS,RspfxConfig
