Different results with CLI or with mitosis.config.js
See original GitHub issueHello,
For sure I’m doing something wrong but I’m having different results using mitosis.config.js
than the cli.
module.exports = {
files: 'src/**/*.lite.tsx',
dest: 'packages',
options: {},
targets: ['react', 'html', 'angular']
};
This generates compiled JS files not components.
but using commands like:
mitosis compile --to=react src/button/button.lite.tsx > packages/react/src/button/button.lite.jsx
Generates the expected component. I’was digging into the docs and config options but I cannot find how to using the config file I can have the same result, I don’t need the code compiled I’m good with just the components.
Sorry for not understanding this, if not possible no problem I’ll use the CLI commands into npm scripts and done
Issue Analytics
- State:
- Created a year ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
CLI: toggle JS/TS output · Issue #511 · BuilderIO/mitosis
We want to add some logic to toggle TS output on/off in the CLI commands, and select .ts / .js (or .jsx /...
Read more >Intro to Mitosis: The universal reactive transformer
Mitosis is the JavaScript compiler that lets developers "write once, run anywhere," then compile to Angular, Vue, Svelte, and more.
Read more >Same vue.config.js producing different results when ...
Solution: Putting a symlink inside of the project root and altering webpack. config. json (resolve: {symlinks: false}) fixed this issue.
Read more >A Quick Guide to Mitosis: Why You Need It and How You ...
Mitosis is a compile-time framework that allows you to write components in JSX and compile to vanilla JavaScript, Angular, React, Vue and more....
Read more >Mitosis CLI
Known issues · Running mitosis from the root of this repository breaks due to some dynamic babel configuration look up · Files that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
One thing I noticed:
mitosis build
andmitosis compile
are different commands that do different things:mitosis compile
is a much simpler command: it takes 1 file and outputs it to one target.mitosis build
will handle an entire directory, which may include non-mitosis JS/TS files etc.You have been interchanging the two, so I believe that’s where the discrepancy lies. Looking at https://github.com/CKGrafico/papanasi/commit/722b96790711c559eac73d5ce484dd2d89c4d841#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L8, you were using
mitosis build
, but in this issue, you’re comparing its output to that ofmitosis compile
. So the issue is not CLI vsmitosis.config.js
, it’sbuild
vscompile
.Yup, I hear you! That’s exactly what we’ve realized as well while generating react-native code. We’re open to remove the transpile step I linked to in the previous comment, and leaving that off to the end-user. Alternatively, we can move it behind a
shouldTranspileComponent: boolean
flag for react/react-native configurations.@ixTec This has indeed been solved. If you provide a
typescript: true
boolean to a generator’soptions
, then it will return the original, non-transpiled component:Example: