Open 0m4r opened 5 months ago
@0m4r thanks for raising the issue.
This is indeed a weird behavior which I believe has to be fixed in the stencil-ds-output-targets
project. As far as I can see, Stencil correctly creates a main entry bundle in packages/stencil-library/dist/components/index.js
that, when imported, would execute the global script for the components. From what I see the issue is within the React output target that imports the components directly and therefore ignores the global script from the main entry file.
I will ingest this into our backlog for the team to take a look at.
is it possible to track the progress of the injected ticket? would you be able to share a timeline for it to be worked on and possibly resolved and released? It has quite an impact for the project I am working on and the more information I can collect the better.
Of course, I am also available for any other kind of help I can provide.
Of course, I am also available for any other kind of help I can provide.
I can't give you any ETAs on when this will be resolved and released. If you like to take a stab at this we are happy to review changes and schedule them into our next release.
I would love to, but I am afraid I do not have enough knowledge to contribute. I will see what I can do :) thanks for your reply!
@0m4r I have exactly the same config that you but a totally different issue. Nothing related to your issue. But I would like to know if you could help me a bit?
I've checked my network tab in the browser console and I noticed that all my web components are loaded in angular whereas I only need one.
import { Component2 } from 'component-library';
I import only Component2 but in my network tab I can see component1, 3, 4, ... and it makes the page very heavy.
Do you have something similar or only the right component is called ?
@ Loic57 this is offtopic here, but the behavior expected by this type of configuration, so it is working as expected. If you need a different behavior, refer to this for configure it differently: https://stenciljs.com/docs/angular#adding-the-angular-output-target
Prerequisites
Stencil Version
4.16.0
Current Behavior
When configuring stencil using the following configuration, the code in the file set to
globalScript
is not executed. TheoutputTargets
dist-custom-elements
has setincludeGlobalScripts: true
Expected Behavior
when
globalScript
is properly set theoutputTargets
dist-custom-elements
has setincludeGlobalScripts: true
the code specified inglobalScript
is executed (as documented here: TheoutputTargets
dist-custom-elements
has setincludeGlobalScripts: true
)System Info
Steps to Reproduce
The issue can be replicated with the code at this git repo: https://github.com/0m4r/stencil-single-export-module-global-script-bug
Once cloned:
npm install
npm run build
npm run build
npm run dev
Code Reproduction URL
https://github.com/0m4r/stencil-single-export-module-global-script-bug
Additional Information
No response