egoist / egoist/tsup

I would like to export separated build for web and mobile

Open
#727 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

Hello,

I would like to support two file for web (react) and mobile (react-native) and be able to import that way:

- For the web : `import { someAsset } from "mylib/web"` or just `import { someAsset } from "mylib"`
- For the mobile `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 my `main` entry:
```ts
export default defineConfig({
entry: ["src/web.ts", "src/native.ts"],
outDir: "./",
format: ["esm", "cjs"],
dts: true,
sourcemap: !isRelease,
silent: isRelease,
clean: false,
treeshake: isRelease,
});
```

Any recommendation on that pattern ?

Regards

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.