Skip to content

Commit f0649d3

Browse files
authored
fix: dev server type (#28)
1 parent 8b810a5 commit f0649d3

File tree

6 files changed

+109
-79
lines changed

6 files changed

+109
-79
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,10 @@
103103
},
104104
"peerDependencies": {
105105
"@rspack/core": "*"
106+
},
107+
"pnpm": {
108+
"overrides": {
109+
"@rspack/core": "npm:@rspack-canary/[email protected]"
110+
}
106111
}
107112
}

pnpm-lock.yaml

Lines changed: 93 additions & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface ResolvedDevServer extends DevServer {
1313
magicHtml: boolean;
1414
liveReload: boolean;
1515
webSocketServer: false | WebpackDevServer.WebSocketServerConfiguration;
16-
proxy: WebpackDevServer.ProxyConfigArray;
16+
proxy: Required<DevServer["proxy"]>;
1717
client: WebpackDevServer.ClientConfiguration;
1818
allowedHosts: "auto" | string[] | "all";
1919
bonjour: false | Record<string, never> | WebpackDevServer.BonjourOptions;

src/server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export class RspackDevServer extends WebpackDevServer {
5151
/**
5252
* resolved after `normalizedOptions`
5353
*/
54+
/** @ts-ignore: types of path data of rspack is not compatible with webpack */
5455
declare options: ResolvedDevServer;
5556

5657
declare staticWatchers: FSWatcher[];
@@ -68,7 +69,7 @@ export class RspackDevServer extends WebpackDevServer {
6869

6970
constructor(options: DevServer, compiler: Compiler | MultiCompiler) {
7071
// biome-ignore lint/suspicious/noExplicitAny: _
71-
super(options, compiler as any);
72+
super(options as WebpackDevServer.Configuration, compiler as any);
7273
// override
7374
}
7475

tests/e2e/module-federation.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ describe("Module federation", () => {
259259
const remoteEntryTextContent = await response.text();
260260

261261
expect(remoteEntryTextContent).toMatch(
262-
/@rspack\/core(-canary)?\/hot\/dev-server\.js/,
262+
/@rspack(-canary?)\/core\/hot\/dev-server\.js/,
263263
);
264264

265265
expect(consoleMessages.map((message) => message.text())).toMatchSnapshot(
@@ -285,7 +285,7 @@ describe("Module federation", () => {
285285
const mainEntryTextContent = await response.text();
286286

287287
expect(mainEntryTextContent).toMatch(
288-
/@rspack\/core(-canary)?\/hot\/dev-server\.js/,
288+
/@rspack(-canary?)\/core\/hot\/dev-server\.js/,
289289
);
290290

291291
expect(consoleMessages.map((message) => message.text())).toMatchSnapshot(

tests/fixtures/worker-config-dev-server-false/public/worker-bundle.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,18 @@ return module.exports;
2727
/************************************************************************/
2828
// webpack/runtime/rspack_version
2929
(() => {
30-
__webpack_require__.rv = function () {
31-
return "1.0.11";
32-
};
33-
30+
__webpack_require__.rv = () => ("1.3.6-canary-ece12b8c-20250422072221")
3431
})();
3532
// webpack/runtime/rspack_unique_id
3633
(() => {
37-
__webpack_require__.ruid = "bundler=rspack@1.0.11";
34+
__webpack_require__.ruid = "bundler=rspack@1.3.6-canary-ece12b8c-20250422072221";
3835

3936
})();
4037
/************************************************************************/
38+
39+
/*!*******************!*\
40+
!*** ./worker.js ***!
41+
\*******************/
4142
postMessage("I'm working before postMessage");
4243

4344
onmessage = (event) => {

0 commit comments

Comments
 (0)