Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.8.2 - Different tsconfig.json setup #3328

Closed
bianpratama opened this issue Jun 26, 2023 · 5 comments · Fixed by #3450
Closed

v1.8.2 - Different tsconfig.json setup #3328

bianpratama opened this issue Jun 26, 2023 · 5 comments · Fixed by #3450

Comments

@bianpratama
Copy link

Version 1.8.2 brought breaking changes on how files are included.

Before the update this is my tsconfig.package.json:

{
  "extends": "./tsconfig.json",
  "include": [
    "./@package/index.ts",
  ],
  "compilerOptions": {
    "outDir": "../build/typings",
    "removeComments": false,
    "declaration": true,
    "declarationDir": "build/typings",
    "emitDeclarationOnly": true,
    "noEmit": false
  }
}

After update, I need to include all Vue files using glob pattern. And if I also have any Vue files that I don't want to export, e.g. Vue files for demo/Storybook purposes. Then, I need to exclude using glob pattern.

{
  "extends": "./tsconfig.json",
  "include": [
    "./@package/index.ts",
    "./@package/**/*.vue" // Added
  ],
  "exclude": [
    "./@package/**/stories/*.vue" // Added
  ],
  "compilerOptions": {
    "outDir": "../build/typings",
    "removeComments": false,
    "declaration": true,
    "declarationDir": "build/typings",
    "emitDeclarationOnly": true,
    "noEmit": false
  }
}

Is this the expected config setup, to include and exclude specific files?

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Jun 27, 2023

Yes this is the expected configuration for the current version, but usually "./@package/**/*" is the more common configuration.

It seems that in the past you were relying on index.ts indirection reference to automatically include .vue files (Even if it may not be under ./@package/), is this the behavior you expected?

@rchl
Copy link
Collaborator

rchl commented Jun 27, 2023

@johnsoncodehk this is the kind of case I was thinking of when asking the #3326 (comment) question.

I'm not sure what's the exact case here but if the index.ts references the vue files then shouldn't that automatically get included in the project (even if node_modules are by default excluded in tsconfig)? That would be the case with plain .ts/.js files at least so it would seem to me that volar should attempt to behave the same if possible. And if not then maybe the previous behavior is needed?

(just asking questions here. haven't investigated this myself or know exactly what's the issue...)

@bianpratama
Copy link
Author

@johnsoncodehk
Yes, we use index.ts for barrel file to references all components that need be bundled. And all of our components are inside the @package folder.

Each component folder exported with an index.ts:

export { default as NeonAvatar } from './NeonAvatar.vue'
export { default as NeonAvatarRandom } from './NeonAvatarRandom.vue'
Folder Structure Screenshot 2023-06-27 at 15 04 21
Entrypoint index.ts Screenshot 2023-06-27 at 15 06 29

I expect that all Vue components that are referenced leading to main index.ts is automatically included, just like .ts or .js files, and what @rchl said above. For now, the recommended tsconfig setup is fine for me, as it improves the performance 🚀

@fdc-viktor-luft
Copy link

This is especially problematic and different from TS file inclusions in Mono-Repo-Setups.

For instance I have to add all *.vue files from included packages of the mono repo in all TS-Configs that include these packages. I don't have to do this for the *.ts files. But it could be also related to the fact that the "skipLibCheck" doesn't work as in TS.

@ipcjs
Copy link

ipcjs commented Jul 27, 2023

Has the issue been fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants