Created
August 8, 2023 14:31
-
-
Save mizchi/e77d228663b748b283918dcfc6b518a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as qwikOptimizer from "@builder.io/qwik/optimizer"; | |
const optimizer = await qwikOptimizer.createOptimizer(); | |
const code = ` | |
export default () => { | |
return ( | |
<> | |
<h1>Hello</h1> | |
</> | |
); | |
}; | |
`; | |
const transformed = optimizer.transformModulesSync({ | |
input: [{ | |
path: "src/main.tsx", | |
code: code, | |
}], | |
srcDir: "src/", | |
isServer: true, | |
transpileJsx: true, | |
transpileTs: true, | |
// rootDir?: string; | |
// entryStrategy?: EntryStrategy; | |
// minify?: MinifyMode; | |
// sourceMaps?: boolean; | |
// transpileTs?: boolean; | |
// transpileJsx?: boolean; | |
// preserveFilenames?: boolean; | |
// explicitExtensions?: boolean; | |
// mode?: EmitMode; | |
// scope?: string; | |
// stripExports?: string[]; | |
// regCtxName?: string[]; | |
// stripCtxName?: string[]; | |
// stripEventHandlers?: boolean; | |
// isServer?: boolean; | |
}); | |
console.log(transformed.modules[0].code); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment