I have been exploring the possibility of injecting one or more stencil's web-component to any web-page on internet by using a chrome extension. However the lazy loading feature of stenciljs has turned out to be an obstacle in my case.
In the first step,I loaded the core files i.e component.core.js and component.js and entry file of my component, by listing them in manifest.json (in web_accessible_resources array)
manifest.json
"web_accessible_resources": [
"js/web-component.js",
"js/web-components/web-components.core.js",
"js/web-components/my-component.entry.js",]
Then appended them to the webpage as a script element. This worked fine.
Problem arises as soon as I add one of my component to the DOM, Stencil tries to lazy load the component.entry.js file from the resources folder whose path I must provide either from stencil.config.ts or as data-resources-url attribute on the script tag of component.core.js in the DOM.
Now I am not sure how can I provide stencil the correct path to component's resources that are located in extension?