Skip to content

Commit

Permalink
chore: use dyn import plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Timeless0911 committed Aug 1, 2024
1 parent 8c84b24 commit 690dbf6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
mergeRsbuildConfig,
} from '@rsbuild/core';
import glob from 'fast-glob';
import { pluginDts } from 'rsbuild-plugin-dts';
import { DEFAULT_CONFIG_NAME, DEFAULT_EXTENSIONS } from './constant';
import type {
Format,
Expand Down Expand Up @@ -294,14 +293,15 @@ const getBundleConfig = (bundle = true): RsbuildConfig => {
};
};

const getDefaultDtsConfig = (
const getDefaultDtsConfig = async (
libConfig: LibConfig,
entryConfig: RsbuildConfig,
): RsbuildConfig => {
): Promise<RsbuildConfig> => {
const { dts, bundle, output } = libConfig;

if (dts === false || dts === undefined) return {};

const { pluginDts } = await import('rsbuild-plugin-dts');
return {
plugins: [
pluginDts({
Expand Down Expand Up @@ -353,7 +353,10 @@ async function postUpdateRsbuildConfig(
dirname(configPath),
);

const defaultDtsConfig = getDefaultDtsConfig(libConfig, defaultEntryConfig);
const defaultDtsConfig = await getDefaultDtsConfig(
libConfig,
defaultEntryConfig,
);

return mergeRsbuildConfig(
defaultTargetConfig,
Expand Down

0 comments on commit 690dbf6

Please sign in to comment.