summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@matthewphillips.info> 2021-03-30 16:07:12 -0400
committerGravatar GitHub <noreply@github.com> 2021-03-30 16:07:12 -0400
commit3e82a0052db4afa16cbf95193fe53d9956809aa4 (patch)
tree54803756fa66776e95fe39bb10ebb97a881a9746 /src
parent1c0590aeffd7f79bbb0e9c62b9ee9be4d6b9a64b (diff)
downloadastro-3e82a0052db4afa16cbf95193fe53d9956809aa4.tar.gz
astro-3e82a0052db4afa16cbf95193fe53d9956809aa4.tar.zst
astro-3e82a0052db4afa16cbf95193fe53d9956809aa4.zip
Add minification (#42)
Diffstat (limited to 'src')
-rw-r--r--src/build/bundle.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/build/bundle.ts b/src/build/bundle.ts
index 322586a35..68d2e5131 100644
--- a/src/build/bundle.ts
+++ b/src/build/bundle.ts
@@ -1,5 +1,5 @@
import type { AstroConfig, ValidExtensionPlugins } from '../@types/astro';
-import type { ImportDeclaration, ExportNamedDeclaration, VariableDeclarator, Identifier, VariableDeclaration } from '@babel/types';
+import type { ImportDeclaration } from '@babel/types';
import type { InputOptions, OutputOptions } from 'rollup';
import type { AstroRuntime } from '../runtime';
@@ -10,6 +10,7 @@ import { walk } from 'estree-walker';
import babelParser from '@babel/parser';
import path from 'path';
import { rollup } from 'rollup';
+import { terser } from 'rollup-plugin-terser';
const { transformSync } = esbuild;
const { readFile } = fsPromises;
@@ -238,6 +239,11 @@ export async function bundle(imports: Set<string>, { runtime, dist }: BundleOpti
entryFileNames(chunk) {
return chunk.facadeModuleId!.substr(1);
},
+ plugins: [
+ // We are using terser for the demo, but might switch to something else long term
+ // Look into that rather than adding options here.
+ terser()
+ ],
};
await build.write(outputOptions);