bug: Assetpath does not work in react output directory
Prerequisites
- [X] I have read the Contributing Guidelines.
- [X] I agree to follow the Code of Conduct.
- [X] I have searched for existing issues that already report this problem, without success.
Stencil Version
4.18.3
Current Behavior
The assetDirs works well in stencil component where as try to check those component in react output, it does not work well.
The below code which i am using to copy the assetDir to the react folder. But the getAssetPath function does not work.
export const config: Config = {
globalStyle: "src/global/global.css",
extras: {
experimentalSlotFixes: true,
experimentalScopedSlotChanges: true,
},
namespace: "library",
outputTargets: [
{
type: "dist",
esmLoaderPath: "../loader",
copy: [
{ src: "components/assets", dest: "build/assets" },
{ src: "components/assets", dest: "../esm/assets" },
{ src: "components/assets", dest: "../../../react-library/dist/build/assets" },
],
},
{
type: "www",
// serviceWorker: null, // disable service workers
copy: [{ src: "components/assets", dest: "build/assets" }],
},
reactOutputTarget({
componentCorePackage: "ai12z",
proxiesFile: "../react-library/lib/components/stencil-generated/index.ts",
includeDefineCustomElements: true,
}),
],
testing: {
browserHeadless: "new",
},
devServer: {
reloadStrategy: "pageReload",
},
}
```
### Expected Behavior
The getAssetpath function should work in react component to retrieve the asset path directory.
### System Info
```shell
"@stencil/core": "^4.18.3",
"@stencil/react-output-target": "^0.5.3",
system : windows 11/ Dell
npm: "10.8.1"
```
### Steps to Reproduce
Copy the asset folder to the react folder and assessing the getAssetPath function in react component.
### Code Reproduction URL
https://github.com/muthupriyashanmugam/stencil-issue
### Additional Information
_No response_
@muthupriyashanmugam thanks for raising an issue and providing a reproducible example. Our team currently has a lot of competing priorities and we can't say when we are able to take a look at this. We would appreciate any support in form of investigation on the root cause or actual fixes. We are happy to answer any technical questions as they arise.
hey @muthupriyashanmugam - poking around the repro doesn't seem to show anything we can test or action; perhaps you made changes?
Normally before trying to consume your components in a react application you would call Stencil's setAssetPath() with the correct / publicly accessible route to your assets.
Gonna close this out for now, if you want to add something concrete for me to test we can look at re-opening.