mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
[ci] format
This commit is contained in:
parent
04070c0c12
commit
4bb96ac8e5
3 changed files with 14 additions and 15 deletions
|
@ -4,7 +4,7 @@ import { defineConfig } from 'astro/config';
|
|||
export default defineConfig({
|
||||
vite: {
|
||||
ssr: {
|
||||
noExternal: ['@example/my-component']
|
||||
noExternal: ['@example/my-component'],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@ import { fileURLToPath } from 'url';
|
|||
import * as vite from 'vite';
|
||||
import { BuildInternals, createBuildInternals } from '../../core/build/internal.js';
|
||||
import { prependForwardSlash } from '../../core/path.js';
|
||||
import { emptyDir, removeDir, resolveDependency } from '../../core/util.js';
|
||||
import { emptyDir, removeDir } from '../../core/util.js';
|
||||
import { runHookBuildSetup } from '../../integrations/index.js';
|
||||
import { rollupPluginAstroBuildCSS } from '../../vite-plugin-build-css/index.js';
|
||||
import type { ViteConfigWithSSR } from '../create-vite';
|
||||
|
@ -67,7 +67,9 @@ export async function staticBuild(opts: StaticBuildOptions) {
|
|||
const ssrResult = (await ssrBuild(opts, internals, pageInput)) as RollupOutput;
|
||||
info(opts.logging, 'build', dim(`Completed in ${getTimeStat(timer.ssr, performance.now())}.`));
|
||||
|
||||
const rendererClientEntrypoints = opts.astroConfig._ctx.renderers.map((r) => r.clientEntrypoint).filter(a => typeof a === 'string') as string[]
|
||||
const rendererClientEntrypoints = opts.astroConfig._ctx.renderers
|
||||
.map((r) => r.clientEntrypoint)
|
||||
.filter((a) => typeof a === 'string') as string[];
|
||||
|
||||
const clientInput = new Set([
|
||||
...internals.discoveredHydratedComponents,
|
||||
|
@ -169,7 +171,7 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
|
|||
async function clientBuild(
|
||||
opts: StaticBuildOptions,
|
||||
internals: BuildInternals,
|
||||
input: Set<string>,
|
||||
input: Set<string>
|
||||
) {
|
||||
const { astroConfig, viteConfig } = opts;
|
||||
const timer = performance.now();
|
||||
|
|
|
@ -35,17 +35,17 @@ const ALWAYS_NOEXTERNAL = new Set([
|
|||
]);
|
||||
|
||||
function getSsrNoExternalDeps(projectRoot: URL): string[] {
|
||||
let noExternalDeps = []
|
||||
let noExternalDeps = [];
|
||||
for (const dep of ALWAYS_NOEXTERNAL) {
|
||||
try {
|
||||
resolveDependency(dep, projectRoot)
|
||||
noExternalDeps.push(dep)
|
||||
resolveDependency(dep, projectRoot);
|
||||
noExternalDeps.push(dep);
|
||||
} catch {
|
||||
// ignore dependency if *not* installed / present in your project
|
||||
// prevents hard error from Vite!
|
||||
}
|
||||
}
|
||||
return noExternalDeps
|
||||
return noExternalDeps;
|
||||
}
|
||||
|
||||
/** Return a common starting point for all Vite actions */
|
||||
|
@ -116,11 +116,8 @@ export async function createVite(
|
|||
conditions: ['astro'],
|
||||
},
|
||||
ssr: {
|
||||
noExternal: [
|
||||
...getSsrNoExternalDeps(astroConfig.root),
|
||||
...thirdPartyAstroPackages,
|
||||
],
|
||||
}
|
||||
noExternal: [...getSsrNoExternalDeps(astroConfig.root), ...thirdPartyAstroPackages],
|
||||
},
|
||||
};
|
||||
|
||||
// Merge configs: we merge vite configuration objects together in the following order,
|
||||
|
@ -147,8 +144,8 @@ function findPluginIndexByName(pluginOptions: vite.PluginOption[], name: string)
|
|||
return pluginOptions.findIndex(function (pluginOption) {
|
||||
// Use isVitePlugin to ignore nulls, booleans, promises, and arrays
|
||||
// CAUTION: could be a problem if a plugin we're searching for becomes async!
|
||||
return isVitePlugin(pluginOption) && pluginOption.name === name
|
||||
})
|
||||
return isVitePlugin(pluginOption) && pluginOption.name === name;
|
||||
});
|
||||
}
|
||||
|
||||
function sortPlugins(pluginOptions: vite.PluginOption[]) {
|
||||
|
|
Loading…
Reference in a new issue