From 048be6d55ebef4081dc6ee5bb204dc6ac0178629 Mon Sep 17 00:00:00 2001 From: Qrac Date: Wed, 11 May 2022 20:49:22 +0900 Subject: [PATCH] Remove duplicate CSS in bundles and partials --- package.json | 2 +- src/build.tsx | 20 ++++---------------- src/generate.ts | 2 -- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index e6cb20c..9905b5a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "minista", "description": "Next.js Like Development with 100% Static Generate", - "version": "2.4.3", + "version": "2.4.4", "bin": { "minista": "./bin/minista.js" }, diff --git a/src/build.tsx b/src/build.tsx index 2462ddc..c636615 100644 --- a/src/build.tsx +++ b/src/build.tsx @@ -394,7 +394,6 @@ export async function buildTempAssets( bundleOutName: string outDir: string assetDir: string - generateJs: boolean } ) { const customConfig = defineViteConfig({ @@ -419,11 +418,6 @@ export async function buildTempAssets( slashEnd(buildOptions.outDir) + buildOptions.bundleOutName + ".css" return item?.source && fs.outputFile(customFileName, item?.source) } else if (item.fileName.match(/__minista_bundle_assets\.js/)) { - if (buildOptions.generateJs) { - const customFileName = - slashEnd(buildOptions.outDir) + buildOptions.bundleOutName + ".js" - return item?.code && fs.outputFile(customFileName, item?.code) - } return } else { const customFileName = @@ -745,7 +739,6 @@ export async function buildPartialHydrateAssets( bundleOutName: string outDir: string assetDir: string - generateJs: boolean usePreact: boolean } ) { @@ -785,16 +778,11 @@ export async function buildPartialHydrateAssets( if (Array.isArray(items) && items.length > 0) { items.map((item) => { if (item.fileName.match(/\.css/)) { - const customFileName = - slashEnd(buildOptions.outDir) + buildOptions.bundleOutName + ".css" - return item?.source && fs.outputFile(customFileName, item?.source) - } else if (item.fileName.match(/\.js/)) { - if (buildOptions.generateJs) { - const customFileName = - slashEnd(buildOptions.outDir) + buildOptions.bundleOutName + ".js" - return item?.code && fs.outputFile(customFileName, item?.code) - } return + } else if (item.fileName.match(/\.js/)) { + const customFileName = + slashEnd(buildOptions.outDir) + buildOptions.bundleOutName + ".js" + return item?.code && fs.outputFile(customFileName, item?.code) } else { const customFileName = buildOptions.outDir + item.fileName.replace(buildOptions.assetDir, "") diff --git a/src/generate.ts b/src/generate.ts index e2f11ec..4321a90 100644 --- a/src/generate.ts +++ b/src/generate.ts @@ -100,7 +100,6 @@ export async function generateTempAssets( bundleOutName: config.assets.bundle.outName, outDir: systemConfig.temp.assets.outDir, assetDir: config.assets.outDir, - generateJs: false, }) await buildCopyDir( systemConfig.temp.assets.outDir, @@ -155,7 +154,6 @@ export async function generatePartialHydration( bundleOutName: config.assets.partial.outName, outDir: systemConfig.temp.assets.outDir, assetDir: config.assets.outDir, - generateJs: true, usePreact: config.assets.partial.usePreact, }) }