fix(astro-integrations): check if distURL is null

This commit is contained in:
xHyroM 2023-06-02 23:44:45 +02:00
parent b09a520282
commit 49546bed12
No known key found for this signature in database
GPG key ID: BE0423F386C436AA

View file

@ -9,10 +9,9 @@ export default (): AstroIntegration => {
hooks: { hooks: {
"astro:build:done": async (opts) => { "astro:build:done": async (opts) => {
for (const route of opts.routes) { for (const route of opts.routes) {
const content = await readFile( if (!route.distURL) continue;
fileURLToPath(route.distURL!),
"utf-8" const content = await readFile(fileURLToPath(route.distURL), "utf-8");
);
const minified = await minify(content, { const minified = await minify(content, {
removeAttributeQuotes: true, removeAttributeQuotes: true,
collapseWhitespace: true, collapseWhitespace: true,