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
An express-style development middleware for use with [Rspack](https://rspack.rs) and webpack-compatible compilers. It serves the files emitted by the compiler from memory.
@@ -86,8 +76,8 @@ See [below](#other-servers) for an example of use with fastify.
86
76
|**[`publicPath`](#publicpath)**|`string`|`undefined`| The public path that the middleware is bound to. |
87
77
|**[`stats`](#stats)**|`boolean\|string\|Object`|`stats` (from a configuration) | Stats options object or preset name. |
88
78
|**[`serverSideRender`](#serversiderender)**|`boolean`|`undefined`| Instructs the module to enable or disable the server-side rendering mode. |
89
-
|**[`writeToDisk`](#writetodisk)**|`boolean\|Function`|`false`| Instructs the module to write files to the configured location on disk as specified in your `webpack` configuration. |
90
-
|**[`outputFileSystem`](#outputfilesystem)**|`Object`|[`memfs`](https://github.com/streamich/memfs)| Set the default file system which will be used by webpack as primary destination of generated files. |
79
+
|**[`writeToDisk`](#writetodisk)**|`boolean\|Function`|`false`| Instructs the module to write files to the configured location on disk as specified in your Rspack configuration.|
80
+
|**[`outputFileSystem`](#outputfilesystem)**|`Object`|[`memfs`](https://github.com/streamich/memfs)| Set the default file system which will be used by Rspack as primary destination of generated files.|
91
81
|**[`modifyResponseData`](#modifyresponsedata)**|`Function`|`undefined`| Allows to set up a callback to change the response data. |
92
82
93
83
The middleware accepts an `options` Object. The following is a property reference for the Object.
@@ -229,7 +219,7 @@ Default: `output.publicPath` (from a configuration)
229
219
230
220
The public path that the middleware is bound to.
231
221
232
-
_Best Practice: use the same `publicPath` defined in your webpack config. For more information about `publicPath`, please see [the webpack documentation](https://webpack.js.org/guides/public-path)._
222
+
> Best Practice: use the same `publicPath` defined in your Rspack config.
233
223
234
224
### stats
235
225
@@ -251,20 +241,18 @@ Please see [Server-Side Rendering](#server-side-rendering) for more information.
251
241
Type: `Boolean|Function`
252
242
Default: `false`
253
243
254
-
If `true`, the option will instruct the module to write files to the configured location on disk as specified in your `webpack` config file.
244
+
If `true`, the option will instruct the module to write files to the configured location on disk as specified in your Rspack config file.
255
245
256
246
_Setting `writeToDisk: true` won't change the behavior of `@rspack/dev-middleware`, and bundle files accessed through the browser will still be served from memory._
257
247
258
-
This option provides the same capabilities as the [`WriteFilePlugin`](https://github.com/gajus/write-file-webpack-plugin/pulls).
259
-
260
248
This option also accepts a `Function` value, which can be used to filter which files are written to disk.
261
249
The function follows the same premise as [`Array#filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) in which a return value of `false`_will not_ write the file, and a return value of `true`_will_ write the file to disk. eg.
### Avoid blocking requests to non-webpack resources.
464
+
### Avoid blocking requests to non-Rspack resources.
479
465
480
-
Since `output.publicPath` and `output.filename`/`output.chunkFilename` can be dynamic, it's not possible to know which files are webpack bundles (and they public paths) and which are not, so we can't avoid blocking requests.
466
+
Since `output.publicPath` and `output.filename`/`output.chunkFilename` can be dynamic, it's not possible to know which files are Rspack bundles (and they public paths) and which are not, so we can't avoid blocking requests.
481
467
482
468
But there is a solution to avoid it - mount the middleware to a non-root route, for example:
0 commit comments