Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Publish an isomorphic plug-n-play react component using Tamagui#507

Answeredbynatew
coopermaruyama asked this question inQ&A
Discussion options

Based on the docs, it seems that actually consuming components created with tamagui on the web requires adding a loader in order to compile it in order to get the performance benefits.

However, for people wanting to publish for example, a React UI library as an npm package using Tamagui, it would be unexpected to have to have consumers add a loader in order to use it. In other words, I would not want to have in the docs of my package something like "Step 1: add this tamagui loader to your webpack" or something like that.

I'm wondering if this is something that's been considered and if there are any plans for this. To me it seems that the compiler can theoretically be run as a build script by the package maintainer, such that the following is possible:

In web code:

import{Thing}from'mypackage/web';

In native code:

import{Thing}from'mypackage';

In my head I imagine that when publishing the package, I would run the tamagui compiler which would output some files to something like/dist/web and thenmypackage/web would reference that.

Does this make sense? Is this already possible and I'm just missing how to do it?

You must be logged in to vote
Answered by natewJan 11, 2023

You can just publish a component that depends on@tamagui/core. I think if you want to promote the extra performance you'd have to mention there's an optional compiler, that's just the deal. But it wouldn't be mandatory, everything works at runtime.

Replies: 2 comments

Comment options

You can just publish a component that depends on@tamagui/core. I think if you want to promote the extra performance you'd have to mention there's an optional compiler, that's just the deal. But it wouldn't be mandatory, everything works at runtime.

You must be logged in to vote
0 replies
Answer selected bycoopermaruyama
Comment options

does this mean that one could not publish a component that depends on tamagui components? or if so what is the way to do so to avoid tamagui config issues.

import { Button, Text } from 'tamagui';export function SuperButton({title}) {    return <Button><Text>{title}</Text>    </Button>}
You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
3 participants
@coopermaruyama@natew@aaronmgdr

[8]ページ先頭

©2009-2025 Movatter.jp