-
TL;DRHow can I have both DescriptionThis is maybe not a turborepo question, but rather a generic monorepo question. However, I have not been able to find any answers elsewhere. I'm using SvelteKit with typescript, but I don't think that's related to what I'm struggling with (at least noe SvelteKit). I have one web app ( import { AButton } from "ui";
import AnotherButton from "ui/src/lib/another-button";
import "ui/src/lib/styles.css" However, I would like to skip the One solution I came across was to use the {
"exports": {
"./": "./src/lib/index.ts",
"./AButton": "./src/lib/a-button/index.ts",
"./AnotherButton": "./src/lib/another-button/index.ts"
} However, this broke intellisense in vscode, and I don't enjoy having to add all components inside the package.json. SvelteKit has a package command that creates a package directory containing all the files I want to export, and a new package.json with the |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 9 replies
-
Hi @boyeborg, |
Beta Was this translation helpful? Give feedback.
-
Is there any actual solution to this inside turborepo? |
Beta Was this translation helpful? Give feedback.
-
all you need is to rearrange structure, also you don't need to use exports key in the package.json |
Beta Was this translation helpful? Give feedback.
-
Ahh, I see. Thanks. However, I was hoping to achieve something else: Seems like that when I import like this: however, when I import like this: Ideas? |
Beta Was this translation helpful? Give feedback.
-
In some {
// ...
"files": [
"dist/"
],
"main": "./src/index.ts",
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"default": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./*": {
"require": "./dist/*/index.js",
"import": "./dist/*/index.mjs",
"types": "./dist/*/index.d.ts"
}
},
"typesVersions": {
"*": {
"*": [
"./dist/*/index.d.ts",
"./dist/index.d.ts"
]
}
},
} Import in some import {sleep} from 'helper'
// or
import { sleep } from "helper/timer"; It worded very well. |
Beta Was this translation helpful? Give feedback.
-
Setting publishConfig.directory to {
/- rest... -/
"publishConfig": {
"directory": "src"
},
/- ...rest -/
} |
Beta Was this translation helpful? Give feedback.
In some
package
of turborepo, setpackage.json
as follows:Import in some
app
of turborepo:It worded very well.