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.5k stars 783 forks source link

bug: Asset Copying Issue Folder Structure Flattened in Version 4.21.0 #5983

Open luisbytes opened 6 days ago

luisbytes commented 6 days ago

Prerequisites

Stencil Version

4.21.0

Current Behavior

Files in subfolders, like assets/icons/home.svg, are copied to the top-level folder (assets/home.svg), losing the original folder structure.

Expected Behavior

The folder structure should be preserved, so assets/icons/home.svg should remain in assets/icons/home.svg.

System Info

System: node 20.15.0
    Platform: darwin (22.6.0)
   CPU Model: Apple M1 Pro (10 cpus)
    Compiler: /node_modules/.pnpm/@stencil+core@4.21.0/node_modules/@stencil/core/compiler/stencil.js
       Build: 1724698030
     Stencil: 4.21.0 🐷
  TypeScript: 5.5.3
      Rollup: 2.56.3
      Parse5: 7.1.2
      jQuery: 4.0.0-pre
      Terser: 5.31.1

Steps to Reproduce

  1. Create a subfolder inside assets (e.g., assets/icons/).
  2. Place a file in that subfolder (e.g., assets/icons/home.svg).
  3. Build with version 4.21.0.
  4. Observe that the file is copied to assets/home.svg instead of assets/icons/home.svg.

Code Reproduction URL

https://github.com/ionic-team/stencil

Additional Information

tanner-reits commented 5 days ago

@luisbytes I've confirmed the issue here. In fact, I think this was causing some issues for us in Ionic Framework recently. I'll get this in our backlog so we can take a closer look. Thanks for linking those other issues as well!

Loic57 commented 1 day ago

@luisbytes @tanner-reits Same issue here. It looks like there is a new prop keepDirStructure for the copy task. I used it and everything was fixed : https://stenciljs.com/docs/copy-tasks#keepdirstructure

luisbytes commented 1 day ago

@Loic57 Apparently this solution only applies when using Copy Task in my particular case, I am using assetsdirs