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
Rsbuild should avoid depending on Modern.js packages, so we need to design a new dev server for Rsbuild, and allow Modern.js to replace the builtin dev server.
The text was updated successfully, but these errors were encountered:
The goal of Rsbuild Server is to be lightweight, simple, and easy to expand:
Provide dev/preview capability for rsbuild application
Meet the general configuration capabilities used when starting an application (such as setMiddleware, hmrClient, historyApiFallback,etc).
Support the expansion of server capabilities to meet the complex needs of upper-level frameworks (such as modern.js) for servers
Detail Design
Rsbuild Server uses a minimalist combination of http + connect , with all built-in/extended logic added via middleware.
var connect = require('connect');
var http = require('http');
var app = connect();
app.use(function (req, res, next) {
// req is the Node.js http request object
// res is the Node.js http response object
// next is a function to call to invoke the next middleware
})
//create node.js http server and listen on port
http.createServer(app).listen(3000);
devServers comparison:
Rsbuild DevServer
Modern.js DevServer (old)
webpack-dev-server
Middleware mode
connect
modern.js custom
express
Relationship with prodServer
Shared Middleware
DevServer inherits prodServer
No prodServer
depends on route.json
❌
✔️ (depends on route.json and routing Middleware)
❌
support custom middlewares
✔️
✔️
✔️
support custom plugins
❌
✔️
❌
support static directories
❌
✔️
✔️
ssr support
❌
✔️
❌
proxy support
✔️
✔️
✔️
Breaking changes
Compared to modern.js builder, breaking changes include:
Only match file based on static file paths. For example, if you want to access the page through /, you need to ensure that the html output path is dist/index.html
SPA and multi-entry SPA are not supported by default, this can be achieved by configuring tools.devServer.historyApiFallback
tools.devServer.before/after configuration is not supported, you can use tools.devServer.setupMiddlewares instead
Rsbuild should avoid depending on Modern.js packages, so we need to design a new dev server for Rsbuild, and allow Modern.js to replace the builtin dev server.
The text was updated successfully, but these errors were encountered: