Is it possible to preserve the import structure of the library when it is being imported elsewhere?
For example,
I have src/index.tsx
and src/components/index.tsx
. I create a few entry points in package.json
:
{
"name": "ui",
"version": "0.0.0",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"sideEffects": false,
"private": true,
"scripts": {
"build": "tsup",
"clean": "rm -rf dist",
"dev": "tsup --watch",
"lint": "eslint src/*.ts*"
},
"files": [
"dist",
"src"
],
"devDependencies": {
},
"tsup": {
"splitting": false,
"sourcemap": true,
"clean": true,
"dts": true,
"external": [
"react"
],
"format": [
"esm",
"cjs"
],
"entryPoints": [
"src/index.tsx",
"src/components/index.tsx"
]
}
}
From the app, I want to use import the lib in this way:
import { Button } from "ui/components"
but I am only allowed to import either in this way: import { Button } from "ui"
or import { Button } from "ui/dist/components"
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too