From c58e149d8d5c5c316bcb87f6014ead90eb9987a2 Mon Sep 17 00:00:00 2001 From: Michiel van der Geest Date: Thu, 4 Jan 2024 11:30:43 +0100 Subject: [PATCH] Added option to disable precompilation via vite config (blits: { precompile: true / false}i). --- vite/preCompiler.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vite/preCompiler.js b/vite/preCompiler.js index 677783bc..ce344b6e 100644 --- a/vite/preCompiler.js +++ b/vite/preCompiler.js @@ -2,9 +2,14 @@ import parser from '../src/lib/templateparser/parser.js' import generator from '../src/lib/codegenerator/generator.js' export default function () { + let config return { name: 'preCompiler', + configResolved(resolvedConfig) { + config = resolvedConfig + }, transform(source) { + if (config.blits && config.blits.precompile === false) return source if (source.indexOf('Blits.Component(') > -1 || source.indexOf('Blits.Application(') > -1) { // get the start of the template key in de component configuration object const templateKeyRegex = /template:\s*([`"'])*/g