-
|
Hello there! I have a directory structure like this (link to repro zip):
When this gets built, I would like the dist dir to look like this:
If I use tsc only (excluding any Vue files), then I get that output. However, when I run vue-tsc against a very similar configuration, I get an unhelpful error:
It partially generates the dist dir with the sibling portion of the code, but it seems like it's dying on something in the main src dir. Here are my tsconfig files for running tsconfig.build.json {
"files": [],
"references": [{
"path": "./src/tsconfig.build.json"
}]
}src/tsconfig.build.json {
"compilerOptions": {
"outDir": "../dist",
"composite": true,
"paths": {
"@/*": ["./*"],
"@sibling/*": ["../sibling/src/*"]
}
},
"exclude": ["App.vue", "main.ts"],
"references": [{
"path": "../sibling/tsconfig.sibling.json"
}]
}sibling/tsconfig.sibling.json {
"compilerOptions": {
"outDir": "../dist/sibling",
"rootDir": "src",
"composite": true
}
}The error seems like it comes from the MyComponent.vue file because if I exclude that in the vue-tsc build, it's fine. If I switch to using the project flag instead of build, nothing gets generated, which is kinda odd. Does anyone have any thoughts? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
And of course after posting this, I think I may've fixed it. If I add |
Beta Was this translation helpful? Give feedback.
-
|
Wanted to close the loop on this... I had to not use the Vite dts plugin and run vue-tsc after vite builds. The final tsconfigs look like this: tsconfig.build.json {
"files": [],
"references": [{
"path": "src/tsconfig.build.json"
}, {
"path": "sibling/tsconfig.sibling.json"
}]
}src/tsconfig.build.json {
"compilerOptions": {
"outDir": "../dist",
"target": "esnext",
"baseUrl": ".",
"declaration": true,
"emitDeclarationOnly": true,
"paths": {
"@/*": ["*"],
"@sibling/*": ["../sibling/src/*"]
}
},
"include": [
"**/*.ts",
"**/*.vue"
],
"exclude": ["App.vue", "main.ts"],
"references": [{
"path": "../sibling/tsconfig.sibling.json"
}]
}sibling/tsconfig.sibling.json {
"compilerOptions": {
"composite": true,
"rootDir": "src",
"outDir": "../dist/sibling",
"target": "esnext",
"baseUrl": ".",
"declaration": true,
"emitDeclarationOnly": true
}
}If I attempt to use the dts plugin with that, I get 0 type files that are included in the build and no errors. It's almost like the references to other tsconfigs gets dropped because I can use whatever in the references path, even if it doesn't exist, and no errors, but that would be an issue for that plugin (issue), not here. |
Beta Was this translation helpful? Give feedback.
Wanted to close the loop on this... I had to not use the Vite dts plugin and run vue-tsc after vite builds. The final tsconfigs look like this:
tsconfig.build.json
{ "files": [], "references": [{ "path": "src/tsconfig.build.json" }, { "path": "sibling/tsconfig.sibling.json" }] }src/tsconfig.build.json
{ "compilerOptions": { "outDir": "../dist", "target": "esnext", "baseUrl": ".", "declaration": true, "emitDeclarationOnly": true, "paths": { "@/*": ["*"], "@sibling/*": ["../sibling/src/*"] } }, "include": [ "**/*.ts", "**/*.vue" ], "exclude": ["App.vue", "main.ts"], "references": [{ "path": "../sibling/tsconfig…