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

feat: change typedef output location for dist-custom-elements #4628

Open
3 tasks done
minecrawler opened this issue Jul 27, 2023 · 3 comments
Open
3 tasks done

feat: change typedef output location for dist-custom-elements #4628

minecrawler opened this issue Jul 27, 2023 · 3 comments
Labels
Feature: Want this? Upvote it! This PR or Issue may be a great consideration for a future idea.

Comments

@minecrawler
Copy link

minecrawler commented Jul 27, 2023

Prerequisites

Describe the Feature Request

Stencil currently does not allow you to specify a destination for type declarations that are generated by the dist-custom-elements output target when generateTypeDeclarations: true is set.

Users should be able to configure the target to write type declarations to a different destination (or at least alongside the output target's dir location).

Describe the Use Case

no response

Describe Preferred Solution

{
  type: 'dist-custom-elements',
  dir: 'my/out/dir',
  typesDir: 'my/out/dir/types'
}

OR

{
  type: 'dist-custom-elements',
  dir: 'my/out/dir',
  adjacentTypeDefs: true
}
@ionitron-bot ionitron-bot bot added the triage label Jul 27, 2023
@minecrawler
Copy link
Author

I also just tried to disbale types generation (generateTypeDeclarations: false), which leads to the paths being nearly correct... however they now start with a ., but the slash for the directory is missing :(

For example:

import type { Components, JSX } from ".types/components";

instead of

import type { Components, JSX } from "./types/components";

@tanner-reits tanner-reits self-assigned this Jul 27, 2023
@tanner-reits
Copy link
Member

tanner-reits commented Jul 27, 2023

Hi @minecrawler 👋

So, I think there's two things in your report. First off, Stencil currently doesn't allow you to change where type declaration are generated via the dist-custom-elements output target. That is called out in the Stencil documentation:

Type declaration files will be placed in the dist/types directory in the root of a Stencil project. At this time, this output destination is not able to be configured.

However, we are open to enabling this behavior. That being said, I'm going to convert this issue into a feature request to gauge interest and help us prioritize that work.

Secondly, your comment does appear to be a valid issue. That being said, I'll create a separate issue (#4630) to track that work.

So, keep an eye on both threads for future updates and changes! Thanks again for reporting!

@tanner-reits tanner-reits added Feature: Want this? Upvote it! This PR or Issue may be a great consideration for a future idea. and removed triage labels Jul 27, 2023
@tanner-reits tanner-reits removed their assignment Jul 27, 2023
@tanner-reits tanner-reits changed the title bug: dist-custom-elements dir is not used for all type declarations feat: change typedef output location for dist-custom-elements Jul 27, 2023
@minecrawler
Copy link
Author

minecrawler commented Jul 27, 2023

Hi @tanner-reits ,
Thank you for clearing it up and sorting it out. I was upgrading from a v2 and the typegen changes weren't immediately clear to me, but as you pointed out the docs address the issue.

I was confused about the location of the types, but even more so that the output references them which makes the build unusable for me. I wrote a script to fix the problem for me as a workaround, but I'll also add my use case and hope that the feature will land at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Want this? Upvote it! This PR or Issue may be a great consideration for a future idea.
Projects
None yet
Development

No branches or pull requests

2 participants