Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
SoonIter committed Jul 3, 2024
1 parent f91f767 commit a205292
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/core/src/node/initRsbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ async function createInternalBuildConfig(
const CUSTOM_THEME_DIR =
config?.themeDir ?? path.join(process.cwd(), 'theme');
const baseOutDir = config?.outDir ?? OUTPUT_DIR;
const getRelativePath = (outDir: string) =>
path.isAbsolute(outDir) ? path.relative(cwd, outDir) : outDir;
const csrOutDir = getRelativePath(baseOutDir);
const ssrOutDir = getRelativePath(path.join(baseOutDir, 'ssr'));
const csrOutDir = baseOutDir;
const ssrOutDir = path.join(baseOutDir, 'ssr');

const DEFAULT_THEME = require.resolve('@rspress/theme-default');
const base = config?.base ?? '';
Expand Down Expand Up @@ -245,7 +243,6 @@ async function createInternalBuildConfig(

if (isServer) {
chain.output.filename('main.cjs');
chain.optimization.minimize(false);
}
},
},
Expand All @@ -266,7 +263,6 @@ async function createInternalBuildConfig(
target: 'web',
overrideBrowserslist: webBrowserslist,
distPath: {
// `root` must be a relative path in Rsbuild
root: csrOutDir,
},
},
Expand All @@ -292,9 +288,9 @@ async function createInternalBuildConfig(
target: 'node',
overrideBrowserslist: ssrBrowserslist,
distPath: {
// `root` must be a relative path in Rsbuild
root: ssrOutDir,
},
minify: false,
},
},
}
Expand Down
3 changes: 3 additions & 0 deletions packages/shared/src/runtime-utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export const isSCM = () => Boolean(process.env.BUILD_VERSION);
export const isProduction = () => process.env.NODE_ENV === 'production';

export const isDebugMode = () => {
if (!process.env.DEBUG) {
return false;
}
const values = process.env.DEBUG?.toLocaleLowerCase().split(',') ?? [];
return ['rsbuild', 'builder', '*'].some(key => values.includes(key));
};
Expand Down

0 comments on commit a205292

Please sign in to comment.