Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"connect-history-api-fallback": "^2.0.0",
"connect-next": "^4.0.1",
"cross-env": "^10.1.0",
"css-loader": "^7.1.4",
"express": "^5.2.1",
"hono": "^4.12.9",
"http-compression": "^1.1.2",
Expand All @@ -84,7 +83,6 @@
"selfsigned": "^5.5.0",
"serve-static": "^2.2.1",
"simple-git-hooks": "^2.13.1",
"style-loader": "^4.0.0",
"typescript": "^6.0.2",
"ws": "^8.20.0"
},
Expand Down
1,353 changes: 248 additions & 1,105 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

22 changes: 0 additions & 22 deletions tests/e2e/__snapshots__/hot-and-live-reload.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ exports[`hot and live reload > should work and refresh content using hot module
[HMR] Checking for updates on the server...,
[HMR] Updated modules:,
[HMR] - ./main.css,
[HMR] - <cssloader>/cjs.js!./main.css,
,
[HMR] App is up to date.,
]
`;
Expand All @@ -80,8 +78,6 @@ exports[`hot and live reload > should work and refresh content using hot module
[HMR] Checking for updates on the server...,
[HMR] Updated modules:,
[HMR] - ./main.css,
[HMR] - <cssloader>/cjs.js!./main.css,
,
[HMR] App is up to date.,
]
`;
Expand All @@ -97,8 +93,6 @@ exports[`hot and live reload > should work and refresh content using hot module
[HMR] Checking for updates on the server...,
[HMR] Updated modules:,
[HMR] - ./main.css,
[HMR] - <cssloader>/cjs.js!./main.css,
,
[HMR] App is up to date.,
]
`;
Expand All @@ -114,8 +108,6 @@ exports[`hot and live reload > should work and refresh content using hot module
[HMR] Checking for updates on the server...,
[HMR] Updated modules:,
[HMR] - ./main.css,
[HMR] - <cssloader>/cjs.js!./main.css,
,
[HMR] App is up to date.,
]
`;
Expand All @@ -131,8 +123,6 @@ exports[`hot and live reload > should work and refresh content using hot module
[HMR] Checking for updates on the server...,
[HMR] Updated modules:,
[HMR] - ./main.css,
[HMR] - <cssloader>/cjs.js!./main.css,
,
[HMR] App is up to date.,
]
`;
Expand All @@ -148,8 +138,6 @@ exports[`hot and live reload > should work and refresh content using hot module
[HMR] Checking for updates on the server...,
[HMR] Updated modules:,
[HMR] - ./main.css,
[HMR] - <cssloader>/cjs.js!./main.css,
,
[HMR] App is up to date.,
]
`;
Expand All @@ -165,8 +153,6 @@ exports[`hot and live reload > should work and refresh content using hot module
[HMR] Checking for updates on the server...,
[HMR] Updated modules:,
[HMR] - ./main.css,
[HMR] - <cssloader>/cjs.js!./main.css,
,
[HMR] App is up to date.,
]
`;
Expand All @@ -182,8 +168,6 @@ exports[`hot and live reload > should work and refresh content using hot module
[HMR] Checking for updates on the server...,
[HMR] Updated modules:,
[HMR] - ./main.css,
[HMR] - <cssloader>/cjs.js!./main.css,
,
[HMR] App is up to date.,
]
`;
Expand All @@ -199,8 +183,6 @@ exports[`hot and live reload > should work and refresh content using hot module
[HMR] Checking for updates on the server...,
[HMR] Updated modules:,
[HMR] - ./main.css,
[HMR] - <cssloader>/cjs.js!./main.css,
,
[HMR] App is up to date.,
]
`;
Expand Down Expand Up @@ -238,8 +220,6 @@ exports[`hot and live reload > should work with manual client setup (default) >
[HMR] Checking for updates on the server...,
[HMR] Updated modules:,
[HMR] - ./main.css,
[HMR] - <cssloader>/cjs.js!./main.css,
,
[HMR] App is up to date.,
]
`;
Expand Down Expand Up @@ -277,8 +257,6 @@ exports[`hot and live reload > should work with manual client setup and allow to
[HMR] Checking for updates on the server...,
[HMR] Updated modules:,
[HMR] - ./main.css,
[HMR] - <cssloader>/cjs.js!./main.css,
,
[HMR] App is up to date.,
]
`;
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/reload-config-2/rspack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {
rules: [
{
test: /\.css$/,
use: [{ loader: 'style-loader' }, { loader: 'css-loader' }],
type: 'css',
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/reload-config/rspack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {
rules: [
{
test: /\.css$/,
use: [{ loader: 'style-loader' }, { loader: 'css-loader' }],
type: 'css',
},
],
},
Expand Down
14 changes: 11 additions & 3 deletions tests/helpers/html-generator-plugin.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
const HTMLContentForIndex = `
const HTMLContentForIndex = (styleTags = '') => {
const headStyleTags = styleTags ? `\n ${styleTags}` : '';

return `
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<title>rspack-dev-server</title>
<title>rspack-dev-server</title>${headStyleTags}
</head>
<body>
<h1>rspack-dev-server is running...</h1>
<script type="text/javascript" charset="utf-8" src="/main.js"></script>
</body>
</html>
`;
};

const HTMLContentForAssets = (assetName) => `
<!DOCTYPE html>
Expand Down Expand Up @@ -53,9 +57,13 @@ module.exports = class HTMLGeneratorPlugin {
stage: compiler.rspack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
},
() => {
const indexSource = new RawSource(HTMLContentForIndex);
const testSource = new RawSource(HTMLContentForTest);
const assets = compilation.getAssets();
const styleTags = assets
.filter((asset) => asset.name.endsWith('.css'))
.map((asset) => `<link rel="stylesheet" href="/${asset.name}" />`)
.join('\n ');
const indexSource = new RawSource(HTMLContentForIndex(styleTags));

compilation.emitAsset('index.html', indexSource);
compilation.emitAsset('test.html', testSource);
Expand Down
19 changes: 0 additions & 19 deletions tests/helpers/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@ const path = require('node:path');
const CURRENT_CWD = process.cwd();
const ROOT = path.resolve(__dirname, '../../');

const CSS_LOADER = path.dirname(require.resolve('css-loader'));
const RELATIVE_CSS_LOADER = path.relative(
path.dirname(
path.resolve(__dirname, '../fixtures/reload-config/rspack.config'),
),
CSS_LOADER,
);
const RSPACK = path.dirname(require.resolve('@rspack/core/package.json'));

const normalize = (str) => {
Expand All @@ -19,18 +12,6 @@ const normalize = (str) => {
.split(RSPACK.replace(/(\\)+/g, '/'))
.join('<rspack>');

normalizedStr = normalizedStr
.split(CSS_LOADER.replace(/(\\)+/g, '/'))
.join('<cssloader>');

normalizedStr = normalizedStr
.split(RELATIVE_CSS_LOADER.replace(/(\\)+/g, '/'))
.join('<cssloader>');

normalizedStr = normalizedStr
.split(RELATIVE_CSS_LOADER.replace(/(\\)+/g, '/'))
.join('<cssloader>');

normalizedStr = normalizedStr
.split(ROOT.replace(/(\\)+/g, '/'))
.join('<root>');
Expand Down