-
-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I would like to export separated build for web and mobile #727
Comments
You can use exports to make different config for each path in package.json, for example:
|
Since this is quite similar to my requirement I want to add to this issue instead of opening a new one. When using react-native-web, one often wants to provide a platform specific file extension: This way, web should pick up button.web.tsx while other platforms should use button.tsx. When using tsup, the button.web.tsx file isn't included at all in my dist output. Here's my tsup.config.ts import { defineConfig, Options } from "tsup";
export default defineConfig((options: Options) => ({
entry: {
index: "src/index.tsx",
},
banner: {
js: "'use client'",
},
clean: true,
format: ["cjs", "esm"],
external: ["react"],
dts: true,
...options,
})); Is there any configuration in tsup I can add to support this? |
I'm facing the same issue. |
Hello,
I would like to support two file for web (react) and mobile (react-native) and be able to import that way:
import { someAsset } from "mylib/web"
or justimport { someAsset } from "mylib"
import { someAsset } from "mylib/mobile
.In order to have my .d.ts files generated I'm not sure how to proceed… I want this because I've library that should not be packaged for the web as it's for mobile only and vis-versa.
I've tried such configuration, but I end up with a lot of file at my root folder, which is kind of annoying, also I'm not sure what should be in my
package.json
especially mymain
entry:Any recommendation on that pattern ?
Regards
Upvote & Fund
The text was updated successfully, but these errors were encountered: