Rspack is a JS compiler and TS shifter written in Rust, known for its full support of the Webpack API and high performance.
Based on the official flarum-webpack-config library, I created a Rspack-adapted library, flarum-rspack-config, to configure Rspack-related configuration.This library has been open sourced to Github: GBCLStudio/flarum-rspack-config
Installation
// for npm
npm install -dev flarum-rspack-config @rspack/cli @rspack/core
// for yarn
yarn add -D flarum-rspack-config @rspack/core @rspack/cli
// for pnpm
pnpm add -D flarum-rspack-config @rspack/cli @rspack/core
Usage
Replace webpack.config.js with rspack.config.js (cjs/mjs/ts is fine), and uninstall the original webpack package, then:
rspack.config.js
var config = require('flarum-rspack-config');
module.exports = config(options);
// or simply this
// module.export = require('flarum-rspack-config');
package.json
{
"scripts": {
- "dev": "webpack --mode development --watch",
- "build": "webpack --mode production",
+ "dev": "rspack --mode development --watch",
+ "build": "rspack --mode production",
}
}
Run the build
script to compile the dist file for production.
Other
This library is open source based on the AGPL v3
license, maintained by GBCLStudio, you can support my development at afdian