From 3b36f4f26c08e5090be20dad82c6b6663d820ecb Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Thu, 13 May 2021 22:21:15 -0500 Subject: [PATCH] Use esbuild for inline code --- .eleventy.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.eleventy.js b/.eleventy.js index d4b2dea..dcdfef8 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -28,7 +28,8 @@ import fs from 'fs' import replace_css_url from 'replace-css-url' import dotenv from 'dotenv' import { InlineCodeManager } from '@11ty/eleventy-assets' -import { minify } from 'terser' +import { transformSync } from 'esbuild' + import nuxtConfig from './nuxt.config' @@ -82,7 +83,14 @@ module.exports = function ( eleventyConfig ) { const javascriptCode = fs.readFileSync( assetFileName, { encoding: "UTF-8" }) console.log('Minifying code', componentName) - const minified = await minify( javascriptCode ) + const minified = await transformSync(javascriptCode, { + // loader: 'ts', + // bundle: true, + minify: true, + // format: 'iife', + })//minify( javascriptCode ) + + // console.log('minified', minified) contents = minified.code