Skip to content

Commit

Permalink
fix: fix es build
Browse files Browse the repository at this point in the history
  • Loading branch information
hexf00 committed Dec 27, 2024
1 parent 2798087 commit b6cb887
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions common/shared/vite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ interface IBuildExecuterOptions {
umdDeps: string[];
}

const clone = (data: any) => JSON.parse(JSON.stringify(data));

function getSharedConfig(): InlineConfig {
const sharedConfig: InlineConfig = {
configFile: false,
Expand Down Expand Up @@ -181,7 +183,7 @@ export async function build(options?: IBuildOptions) {
umdDeps,
};

buildUMD(getSharedConfig(), buildExecuterOptions);
buildUMD(getSharedConfig(), clone(buildExecuterOptions));

if (mode === 'bootstrap') {
const presets = fs.readdirSync(path.resolve(__dirname, 'src')).filter(dir => dir.startsWith('preset-'));
Expand Down Expand Up @@ -209,6 +211,6 @@ export async function build(options?: IBuildOptions) {
}
}

buildESM(getSharedConfig(), buildExecuterOptions);
buildCJS(getSharedConfig(), buildExecuterOptions);
buildESM(getSharedConfig(), clone(buildExecuterOptions));
buildCJS(getSharedConfig(), clone(buildExecuterOptions));
}

0 comments on commit b6cb887

Please sign in to comment.