ionic-team / stencil

A toolchain for building scalable, enterprise-ready component systems on top of TypeScript and Web Component standards. Stencil components can be distributed natively to React, Angular, Vue, and traditional web developers from a single, framework-agnostic codebase.
https://stenciljs.com
Other
12.59k stars 789 forks source link

bug: Assetpath does not work in react output directory #5999

Open muthupriyashanmugam opened 1 month ago

muthupriyashanmugam commented 1 month ago

Prerequisites

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

"@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

christian-bromann commented 1 month ago

@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.