Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
SoonIter committed Dec 22, 2024
1 parent 4522637 commit a1141b3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.button {
background: yellow;
background: url('../../assets/logo.svg') no-repeat;
}
3 changes: 3 additions & 0 deletions packages/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,7 @@ const composeBundlelessExternalConfig = (
if (!request || !getResolve || !context || !contextInfo) {
return callback();
}
console.log(222222, data);

if (!resolver) {
resolver = (await getResolve()) as RspackResolver;
Expand All @@ -1009,6 +1010,7 @@ const composeBundlelessExternalConfig = (
jsExtension,
cssModulesAuto,
isStyleRedirected,
contextInfo.issuer,
);

if (cssExternal !== false) {
Expand Down Expand Up @@ -1060,6 +1062,7 @@ const composeBundlelessExternalConfig = (
/\.[^.]+$/,
jsExtension,
);
// return callback();
}
} else {
resolvedRequest = `${resolvedRequest}${jsExtension}`;
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/css/LibCssExtractPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { RSLIB_CSS_ENTRY_FLAG } from './cssConfig';
import {
ABSOLUTE_PUBLIC_PATH,
AUTO_PUBLIC_PATH,
// BASE_URI,
BASE_URI,
SINGLE_DOT_PATH_SEGMENT,
} from './libCssExtractLoader';
import { getUndoPath } from './utils';
Expand Down Expand Up @@ -71,7 +71,7 @@ class LibCssExtractPlugin implements Rspack.RspackPluginInstance {
);
replace(`${ABSOLUTE_PUBLIC_PATH}${AUTO_PUBLIC_PATH}`, undoPath);
replace(ABSOLUTE_PUBLIC_PATH, '');
// replace(`${BASE_URI}/`, undoPath);
replace(`${BASE_URI}/`, undoPath);

return replaceSource;
});
Expand Down
7 changes: 6 additions & 1 deletion packages/core/src/css/cssConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,19 @@ export function cssExternalHandler(
jsExtension: string,
auto: CssLoaderOptionsAuto,
isStyleRedirect: boolean,
issuer: string,
): void | false {
const isCssModulesRequest = isCssModulesFile(request, auto);

// cssExtract would execute the file handled by css-loader, so we cannot external the "helper import" from css-loader
// do not external @rsbuild/core/compiled/css-loader/noSourceMaps.js, sourceMaps.js, api.mjs etc.
// 1. do not external @rsbuild/core/compiled/css-loader/noSourceMaps.js, sourceMaps.js, api.mjs etc.
if (/compiled\/css-loader\//.test(request)) {
return callback();
}
// 2.
if (isCssFile(issuer) && !isCssFile(request)) {
return callback();
}

// 1. css modules: import './CounterButton.module.scss' -> import './CounterButton.module.mjs'
// 2. css global: import './CounterButton.scss' -> import './CounterButton.css'
Expand Down

0 comments on commit a1141b3

Please sign in to comment.