BuilderIO/mitosis

Project Compiling CLI

Open

#173 opened on Feb 13, 2022

View on GitHub
 (1 comment) (1 reaction) (1 assignee)TypeScript (9,803 stars) (411 forks)batch import
enhancementhelp wanted

Description

Today, we only compile one file at a time. What would be most useful for most peoples setups, though, would be to compile a project, for instance

package.json
src/
   my-component.lite.tsx
   my-dependency.ts

could compile to a fully installable package per framework, like

dist/
  package.json
  react/
    my-component.js # compiled to react JS
    my-dependency.js
  vue/
    my-component.js # compiled to Vue
    my-dependency.js

where you can do like

import { MyComponent } from 'project-name/react'

or

import { MyComponent } from 'project-name/vue'

we have begun exploring this direction. a few things we've noticed

  • vue2 vs vue3 have different ways of compiling. and nuxt2 doesn't want precompiled components. so even per framework we might want different outputs in different folders. like vue2/, vue3/, nuxt2/, etc
  • some frameworks, like react native, need overrides. so we started experimenting with an overrides/ folder convention where you can override any file per-output, and it just compiles and copies over to the dist/output dir

Contributor guide