budibase/packages/server/scripts/svelteTransformer.js

12 lines
314 B
JavaScript

const { compile } = require("svelte/compiler")
const { transformSync } = require("@babel/core")
module.exports = {
process(sourceText) {
const { js } = compile(sourceText, { css: "injected", generate: "ssr" })
const { code } = transformSync(js.code, { babelrc: true })
return { code: code }
},
}