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: 1 addition & 1 deletion packages/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ export async function loadConfig({

let configExport: RsbuildConfigExport;

if (/\.(?:js|mjs|cjs)$/.test(configFilePath) || loader === 'native') {
if (loader === 'native' || /\.(?:js|mjs|cjs)$/.test(configFilePath)) {
try {
const exportModule = await import(`${configFilePath}?t=${Date.now()}`);
configExport = exportModule.default ? exportModule.default : exportModule;
Expand Down
9 changes: 9 additions & 0 deletions packages/core/src/provider/initConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ const initEnvironmentConfigs = (
};
};

const validateRsbuildConfig = (config: NormalizedConfig) => {
if (config.server.base && !config.server.base.startsWith('/')) {
throw new Error(
`[rsbuild:config] The "server.base" option should start with a slash, for example: "/base"`,
);
}
};

export async function initRsbuildConfig({
context,
pluginManager,
Expand Down Expand Up @@ -215,6 +223,7 @@ export async function initRsbuildConfig({

await updateEnvironmentContext(context, environments);
updateContextByNormalizedConfig(context);
validateRsbuildConfig(context.normalizedConfig);

return context.normalizedConfig;
}
Expand Down