Skip to content

Commit bf3e46f

Browse files
authored
refactor: rename webpack-dev-server to rspack-dev-server (#86)
1 parent dff393c commit bf3e46f

9 files changed

Lines changed: 131 additions & 132 deletions

File tree

client-src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,9 @@ const reloadApp = (
269269
}
270270

271271
const search = self.location.search.toLowerCase();
272-
const allowToHot = search.indexOf('webpack-dev-server-hot=false') === -1;
272+
const allowToHot = search.indexOf('rspack-dev-server-hot=false') === -1;
273273
const allowToLiveReload =
274-
search.indexOf('webpack-dev-server-live-reload=false') === -1;
274+
search.indexOf('rspack-dev-server-live-reload=false') === -1;
275275

276276
if (hot && allowToHot) {
277277
log.info('App hot update...');

client-src/overlay.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -460,15 +460,15 @@ const createOverlay = (options: CreateOverlayOptions): StateMachine => {
460460
// Enable Trusted Types if they are available in the current browser.
461461
if (window.trustedTypes) {
462462
overlayTrustedTypesPolicy = window.trustedTypes.createPolicy(
463-
trustedTypesPolicyName || 'webpack-dev-server#overlay',
463+
trustedTypesPolicyName || 'rspack-dev-server#overlay',
464464
{
465465
createHTML: (value: string) => value,
466466
},
467467
);
468468
}
469469

470470
iframeContainerElement = document.createElement('iframe');
471-
iframeContainerElement.id = 'webpack-dev-server-client-overlay';
471+
iframeContainerElement.id = 'rspack-dev-server-client-overlay';
472472
iframeContainerElement.src = 'about:blank';
473473
applyStyle(iframeContainerElement, iframeStyle);
474474

@@ -480,7 +480,7 @@ const createOverlay = (options: CreateOverlayOptions): StateMachine => {
480480
iframeContainerElement?.contentDocument as Document
481481
).createElement('div');
482482

483-
contentElement.id = 'webpack-dev-server-client-overlay-div';
483+
contentElement.id = 'rspack-dev-server-client-overlay-div';
484484
applyStyle(contentElement, containerStyle);
485485

486486
headerElement = document.createElement('div');
@@ -590,7 +590,7 @@ const createOverlay = (options: CreateOverlayOptions): StateMachine => {
590590
typeElement.setAttribute('data-can-open', 'true');
591591
typeElement.addEventListener('click', () => {
592592
fetch(
593-
`/webpack-dev-server/open-editor?fileName=${message.moduleIdentifier}`,
593+
`/rspack-dev-server/open-editor?fileName=${message.moduleIdentifier}`,
594594
);
595595
});
596596
}

src/server.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,8 +1775,8 @@ class Server<
17751775

17761776
// Should be after `webpack-dev-middleware`, otherwise other middlewares might rewrite response
17771777
middlewares.push({
1778-
name: 'webpack-dev-server-sockjs-bundle',
1779-
path: '/__webpack_dev_server__/sockjs.bundle.js',
1778+
name: 'rspack-dev-server-sockjs-bundle',
1779+
path: '/__rspack_dev_server__/sockjs.bundle.js',
17801780
middleware: (req: Request, res: Response, next: NextFunction) => {
17811781
if (req.method !== 'GET' && req.method !== 'HEAD') {
17821782
next();
@@ -1818,8 +1818,8 @@ class Server<
18181818
});
18191819

18201820
middlewares.push({
1821-
name: 'webpack-dev-server-invalidate',
1822-
path: '/webpack-dev-server/invalidate',
1821+
name: 'rspack-dev-server-invalidate',
1822+
path: '/rspack-dev-server/invalidate',
18231823
middleware: (req: Request, res: Response, next: NextFunction) => {
18241824
if (req.method !== 'GET' && req.method !== 'HEAD') {
18251825
next();
@@ -1833,8 +1833,8 @@ class Server<
18331833
});
18341834

18351835
middlewares.push({
1836-
name: 'webpack-dev-server-open-editor',
1837-
path: '/webpack-dev-server/open-editor',
1836+
name: 'rspack-dev-server-open-editor',
1837+
path: '/rspack-dev-server/open-editor',
18381838
middleware: (req: Request, res: Response, next: NextFunction) => {
18391839
if (req.method !== 'GET' && req.method !== 'HEAD') {
18401840
next();

src/servers/SockJSServer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class SockJSServer extends BaseServer {
6161
return options.sockjsUrl;
6262
}
6363

64-
return '/__webpack_dev_server__/sockjs.bundle.js';
64+
return '/__rspack_dev_server__/sockjs.bundle.js';
6565
};
6666

6767
this.implementation = sockjs.createServer({

tests/e2e/__snapshots__/hot-and-live-reload.test.js.snap.webpack5

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ exports[`hot and live reload > should not refresh content when hot and no live r
2727

2828
exports[`hot and live reload > should not refresh content when hot and no live reload disabled (ws) > page errors 1`] = `[]`;
2929

30-
exports[`hot and live reload > should work and allow to disable hot module replacement and live reload using the "webpack-dev-server-hot=false&webpack-dev-server-live-reload=false" (default) > console messages 1`] = `
30+
exports[`hot and live reload > should work and allow to disable hot module replacement and live reload using the "rspack-dev-server-hot=false&rspack-dev-server-live-reload=false" (default) > console messages 1`] = `
3131
[
3232
[rspack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.,
3333
[HMR] Waiting for update signal from WDS...,
3434
[rspack-dev-server] App updated. Recompiling...,
3535
]
3636
`;
3737

38-
exports[`hot and live reload > should work and allow to disable hot module replacement and live reload using the "webpack-dev-server-hot=false&webpack-dev-server-live-reload=false" (default) > page errors 1`] = `[]`;
38+
exports[`hot and live reload > should work and allow to disable hot module replacement and live reload using the "rspack-dev-server-hot=false&rspack-dev-server-live-reload=false" (default) > page errors 1`] = `[]`;
3939

40-
exports[`hot and live reload > should work and allow to disable hot module replacement using the "webpack-dev-server-hot=false" (default) > console messages 1`] = `
40+
exports[`hot and live reload > should work and allow to disable hot module replacement using the "rspack-dev-server-hot=false" (default) > console messages 1`] = `
4141
[
4242
[rspack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.,
4343
[HMR] Waiting for update signal from WDS...,
@@ -48,16 +48,16 @@ exports[`hot and live reload > should work and allow to disable hot module repla
4848
]
4949
`;
5050

51-
exports[`hot and live reload > should work and allow to disable hot module replacement using the "webpack-dev-server-hot=false" (default) > page errors 1`] = `[]`;
51+
exports[`hot and live reload > should work and allow to disable hot module replacement using the "rspack-dev-server-hot=false" (default) > page errors 1`] = `[]`;
5252

53-
exports[`hot and live reload > should work and allow to disable live reload using the "webpack-dev-server-live-reload=false" (default) > console messages 1`] = `
53+
exports[`hot and live reload > should work and allow to disable live reload using the "rspack-dev-server-live-reload=false" (default) > console messages 1`] = `
5454
[
5555
[rspack-dev-server] Server started: Hot Module Replacement disabled, Live Reloading enabled, Progress disabled, Overlay enabled.,
5656
[rspack-dev-server] App updated. Recompiling...,
5757
]
5858
`;
5959

60-
exports[`hot and live reload > should work and allow to disable live reload using the "webpack-dev-server-live-reload=false" (default) > page errors 1`] = `[]`;
60+
exports[`hot and live reload > should work and allow to disable live reload using the "rspack-dev-server-live-reload=false" (default) > page errors 1`] = `[]`;
6161

6262
exports[`hot and live reload > should work and do nothing when web socket server disabled (default) > console messages 1`] = `[]`;
6363

0 commit comments

Comments
 (0)