#1709·mitosis

`json` and `code` plugin callbacks do not run when building Lit components

Author: taylorfsteeleCreated Mar 3, 2025Updated Mar 3, 2025
Labelsbug

I am interested in helping provide a fix!

Yes

Which generators are impacted?

  • All
  • Angular
  • HTML
  • Preact
  • Qwik
  • React
  • React-Native
  • Solid
  • Stencil
  • Svelte
  • Vue
  • Web components

Reproduction case

N/A

Expected Behaviour

When writing a plugin to run against Lit components, the json and code callback functions don't run.

With the plugin:

/**
 * @type {import('@builder.io/mitosis').MitosisConfig}
 */
module.exports = {
  files: "src/**",
  targets: ["lit"],
  dest: "../",
  commonOptions: {
    typescript: true,
  },
  options: {
    lit: {
      plugins: [
        () => ({
          name: "hello-plugin",
          order: 1,
          build: {
            pre: () => console.log("pre build"),
            post: () => console.log("post build"),
          },
          json: {
            pre: () => console.log("pre json"),
            post: () => console.log("post json"),
          },
          code: {
            pre: () => console.log("pre code"),
            post: () => console.log("post post"),
          },
        }),
      ],
    },
  },
};

The CLI should print during the pre and post steps of the build, json, and code steps.

Actual Behaviour

Plugin callbacks with code and json steps do not run against lit components.

With the above example, the CLI prints:

pre build
Mitosis: lit: generated 1 components, 1 regular files.
post build
Mitosis: generation completed.

Additional Information

No response