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: Copy tasks leads to EBUSY: resource busy or locked on Windows OR flattened structure on Mac #5966

Open DrKlonk opened 1 week ago

DrKlonk commented 1 week ago

Prerequisites

Stencil Version

4.21.0

Current Behavior

When we have a copy task for <subfolder> for the dist buildTarget, to ../<subfolder>, we get an error on Windows. On Mac, the structure gets flattened. The folder structure is lost.

Expected Behavior

I expect the assets folder to be copied as is. And I expect to be able to copy it to one folder higher than the dist folder.

System Info

System: node 20.15.0
    Platform: windows (10.0.22631)
   CPU Model: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 cpus)
    Compiler: C:\Users\Joran\code\test\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

Create a Stencil project version 4.21.0

Create an assets folder in src Create a subfolder in the assets folder

Add a copytask to the dist buildTarget with

copy: [{ src: 'assets', dest: '../assets', warn: true }]

Run npm run build

On Windows, it leads to an EBUSY error (reverting to 4.20.0 resolves the issue) On Mac, it leads to all the folders contents to be flattened, i.e. the folder structure in src is lost in the build.

Code Reproduction URL

https://github.com/DrKlonk/stencil-copy-bug

Additional Information

Related to, but different from https://github.com/ionic-team/stencil/issues/5956

christian-bromann commented 1 week ago

Thanks for raising the issue @DrKlonk the Stencil team currently has a lot of competing priorities and can't promise to be able to take a look at this anytime soon. We recommend to get involved and help us resolve this bug by providing a pull request with a fix. We are happy to provide necessary guidance and appreciate any help!

luisbytes commented 4 days ago

Hello @christian-bromann, I think this could be the problem #5899

As @DrKlonk comments in the previous version, the error does not occur.