You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The marko webpack plugin requires some minor changes in order to support rspack, a webpack compatible bundler written in rust that claims to be very fast.
Specifically, rspack is webpack 5 compatible (mostly), but the explicit webpack 5 check in @marko/webpack leads the plugin down incompatible branches.
Additionally an old and deprecated webpack hooks aren't yet (or may never be) supported in rspack, namely the afterOptimizeAssets hook, which seemingly can simply be changed to afterProcessAssets.
Finally, referencing the webpack module, ie for the enum webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS, may not work as webpack may not necessarily be installed. I'm not entirely sure the best approach to solving this, but both rpsack and webpack define this value as -100.
There didn't appear to be any other necessary changes otherwise, though I did not thoroughly test this
Why
We're evaluating ways to make our builds faster. We cannot change our bundler to vite without significant developer cost, so we're stuck with webpack for now.
Supporting rspack may be beneficial to others in a similar situation
Possible Implementation & Open Questions
I would think introducing a new major version that drops support for webpack 4 entirely might be appropriate here. This would remove the need to check the webpack version. The PROCESS_ASSETS_STAGE_ADDITIONS could potentially be hardcoded.
This would remove the need to import webpack, and thus webpack itself could now be made an optionalDependency instead of a peerDependency so that it doesn't necessarily need to be installed alongside this plugin.
Is this something you're interested in working on?
Sure, I would just need guidance on if dropping support for webpack 4 is practical. Otherwise there may need to be a discussion on how to get around importing webpack
I can also make a repro repository, but this is more of a feature request than a bug report so I didn't think it'd be necessary. Theoretically it should be as simple as creating a new project using a webpack 5 based config, renaming it to rpsack.config.[ts/js], and swapping out webpack with rspack in the package scripts.
The text was updated successfully, but these errors were encountered:
Description
The marko webpack plugin requires some minor changes in order to support rspack, a webpack compatible bundler written in rust that claims to be very fast.
Specifically, rspack is webpack 5 compatible (mostly), but the explicit webpack 5 check in @marko/webpack leads the plugin down incompatible branches.
Additionally an old and deprecated webpack hooks aren't yet (or may never be) supported in rspack, namely the
afterOptimizeAssets
hook, which seemingly can simply be changed toafterProcessAssets
.Finally, referencing the
webpack
module, ie for the enumwebpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
, may not work as webpack may not necessarily be installed. I'm not entirely sure the best approach to solving this, but both rpsack and webpack define this value as-100
.There didn't appear to be any other necessary changes otherwise, though I did not thoroughly test this
Why
We're evaluating ways to make our builds faster. We cannot change our bundler to vite without significant developer cost, so we're stuck with webpack for now.
Supporting rspack may be beneficial to others in a similar situation
Possible Implementation & Open Questions
I would think introducing a new major version that drops support for webpack 4 entirely might be appropriate here. This would remove the need to check the webpack version. The
PROCESS_ASSETS_STAGE_ADDITIONS
could potentially be hardcoded.This would remove the need to import
webpack
, and thuswebpack
itself could now be made an optionalDependency instead of a peerDependency so that it doesn't necessarily need to be installed alongside this plugin.Is this something you're interested in working on?
Sure, I would just need guidance on if dropping support for webpack 4 is practical. Otherwise there may need to be a discussion on how to get around importing webpack
I can also make a repro repository, but this is more of a feature request than a bug report so I didn't think it'd be necessary. Theoretically it should be as simple as creating a new project using a webpack 5 based config, renaming it to
rpsack.config.[ts/js]
, and swapping outwebpack
withrspack
in the package scripts.The text was updated successfully, but these errors were encountered: