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(react-output-target): add customElementsDir configuration option #461

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

sean-perkins
Copy link
Contributor

@sean-perkins sean-perkins commented Aug 23, 2024

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally for affected output targets
  • Tests (npm test) were run locally and passed
  • Prettier (npm run prettier) was run locally and passed

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Environments using absolute paths run into issues with using the calculated path for the custom elements directory based on the dist-custom-elements configuration.

Issue URL: Resolves #457

What is the new behavior?

  • Re-adds the customElementsDir configuration for developers to manually override the path as needed in their environment.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Dev-build: @stencil/[email protected]

@dgonzalezr
Copy link
Contributor

dgonzalezr commented Aug 25, 2024

I just tested the dev-build on the same repo as the original issue, and I can confirm that it is now working as expected with the customElementsDir configuration option.

CleanShot 2024-08-25 at 13 56 16@2x

@sean-perkins sean-perkins merged commit 24de01e into main Aug 26, 2024
5 checks passed
@mjsorribas
Copy link

mjsorribas commented Aug 28, 2024

Hi! Can you please add documentation about the implementation in the stencil configuration file?
I have something like this :
outputTargets: [
reactOutputTarget({
stencilPackageName: "@mypackage/my-lib-components",
outDir: "../my-lib-components-react/src/",
customElementsDir: "@mypackage/my-lib-components"
}),
I am not clear about whether this is the correct configuration.
Thanks!

notes:
The version 0.6.0 and 0.7.0 generate a break in the build.

The version 0.6.0 generate a folder called undefined and this one contains a components.d.ts.

The version 0.7.0 not permit build properly the library:
[ ERROR ] Error: The 'react-output-target' requires the 'dist-custom-elements'
output target to have 'externalRuntime: false' set in its
configuration. at Object.validate
(mylib-project/node_modules/@stencil/react-output-target/dist/react-output-target.cjs:37:1647)

The only version that works properly is release 0.5.3.
I used the latest stencil package 4.21.0.

@christian-bromann
Copy link
Member

The version 0.6.0 and 0.7.0 generate a break in the build.

Our team currently doesn't apply strict semver on these output targets as we haven't released a v1.0 just yet.

We have recently updated the docs around the React Output Target. Mind taking a look and help us identify what is missing?

@christian-bromann
Copy link
Member

[ ERROR ] Error: The 'react-output-target' requires the 'dist-custom-elements'
output target to have 'externalRuntime: false' set in its

We recommend this setup when integrating your Stencil components into a React project. With the new release this has been enforced.

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 this pull request may close these issues.

[react-output-target] bug: generated components.ts using absolute paths in an Nx monorepo
5 participants