-
Hi all! We're building a cross-platform library for react and react-native, bundled with tsup. Everything's working fine, but we started adding platform-specific code with the export default defineConfig([
// Web bundle
{
entry: ["src/index.ts"],
// This option doesn't actually exist
extensions: [".web.ts", ".web.tsx", ".ts", ".tsx"],
},
// Native bundle
{
entry: ["src/index.ts"],
// This option doesn't actually exist
extensions: [".native.ts", ".native.tsx", ".ts", ".tsx"],
},
]): Any ideas on how this could be done? |
Beta Was this translation helpful? Give feedback.
Answered by
GuilleDF
Aug 11, 2023
Replies: 1 comment
-
Figured it out! You can set the extensions through the export default defineConfig([
// Web bundle
{
entry: ["src/index.ts"],
outDir: 'dist/web',
esbuildOptions(options) {
options.resolveExtensions = [".web.ts", ".web.tsx", ".ts", ".tsx"];
},
},
// Native bundle
{
entry: ["src/index.ts"],
esbuildOptions(options) {
options.resolveExtensions = [".native.ts", ".native.tsx", ".ts", ".tsx"];
},
},
]): |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
GuilleDF
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Figured it out! You can set the extensions through the
esbuildOptions
config: