Skip to content

Instantly share code, notes, and snippets.

@mizchi
Created August 8, 2023 14:31
Show Gist options
  • Save mizchi/e77d228663b748b283918dcfc6b518a5 to your computer and use it in GitHub Desktop.
Save mizchi/e77d228663b748b283918dcfc6b518a5 to your computer and use it in GitHub Desktop.
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