-
-
Notifications
You must be signed in to change notification settings - Fork 780
Closed
Labels
good first issueGood for newcomersGood for newcomers
Description
Hi all,
First, thanks for creating Rspack!
I'm trying to from Webpack to Rspack and encountered an issue with CopyRspackPlugin's compatibility with CopyWebpackPlugin.
The gist is that in CopyWebpackPlugin, pattern.transform accepts an object whereas CopyRspackPlugin does not (Note: this has been introduced in CopyWebpackPlugin@7)
// CopyWebpackPlugin
type transform =
| {
transformer: (input: string, absoluteFilename: string) => string | Buffer;
cache?: boolean | TransformerCacheObject | undefined;
}
| ((input: string, absoluteFilename: string) => string | Buffer);vs
// CopyRspackPlugin
type Transform = (
input: Buffer,
absoluteFilename: string,
) => string | Buffer | Promise<string> | Promise<Buffer>;This lead to a cryptic error:
# rspack-node[77491]: napi_status napi_release_threadsafe_function(napi_threadsafe_function, napi_threadsafe_function_release_mode) at ../src/node_api.cc:1398
# Assertion failed: (func) != nullptr
I see two possible solutions:
- Accept the API difference, and update the migration docs from Webpack to Rspack relating CopyWebpackPlugin
a. possibly extended with some configuration validation which would throw a more informative error - Update CopyRspackPlugin to align the APIs
Minimal reproduction example: rstackjs/rstack-examples@main...patricksevat:rspack-examples:feat/copy-webpack-plugin-transform-obj-config
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers