stencil icon indicating copy to clipboard operation
stencil copied to clipboard

Configuration: Copy Tasks are not executed for dev builds with target 'dist'

Open joelricci opened this issue 5 years ago • 7 comments

Stencil version:

@stencil/[email protected] 

I'm submitting a: [x] bug report

Current behavior: Copy Tasks (outputTargets) are not run for development builds with target 'dist'.

Expected behavior: Copy Tasks should be executed for development builds with target 'dist'. If this is not the intended behaviour, it should be clearly documented under copy-tasks.

Steps to reproduce:

  1. Create a stencil.config.ts similar to this:
export const config: Config = {
    outputTargets: [{
        type: 'dist',  // make sure target is set to 'dist'
        copy: [{ src: '../somefile.json' }],
    }],
    ...
};
  1. Make a 'full' build:
npx stencil build

Check the dist/ folder for somefile.json - it's there. Note that the file is being copied according to the build log!

  1. Now run a development build:
npx stencil build --dev

Check the dist/ folder again - the file is gone! Note that the file is not being copied according to the build log!

Other information: Doesn't seem to affect www targets, only dist ?

I believe this behaviour has changed a while back and is probably related to this code which seems to silently return before executing the copy tasks.

https://github.com/ionic-team/stencil/blob/65006a1c0484c7048b30e26814cddc73cfc8afba/src/compiler/build/build.ts#L37

joelricci avatar Jun 09 '20 16:06 joelricci

The above mentioned changes were part of the v1.11.0 release on March 20. I have verified that the problem does not exist in v1.10.3.

joelricci avatar Jun 18 '20 08:06 joelricci

I can confirm that this issue still exists in v1.11.3 and v1.14.0 as well for the dist output target. www copies just fine.

nedredmond avatar Jun 24 '20 13:06 nedredmond

I can confirm that this issue still exists in v1.11.3 and v1.14.0 as well for the dist output target. www copies just fine.

This is my experience as well.

Updated Other information:

Doesn't seem to affect www targets, only dist ?

joelricci avatar Jun 24 '20 13:06 joelricci

On 1.14 dist copy task works fine. The trick in the relativity of the folders copy: [{src: 'assets', dest: '../mylib/assets'}], This will copy /src/assets into /dist/mylib/assets. So for dist task try to use dest setting

Jagget avatar Jun 25 '20 16:06 Jagget

I can confirm that this issue still exists in v1.11.3 and v1.14.0 as well for the dist output target. www copies just fine.

@nedredmond : Just out of curiosity, do you copy anything from above the "current working directory" level?

I.e: copy: [{ src: '../foo.bar' }]

joelricci avatar Jul 07 '20 12:07 joelricci

ah I am facing this too. angularOutputTarget folder not generated for dev mode either strange

pranav-js avatar Jan 03 '22 10:01 pranav-js

On 1.14 dist copy task works fine. The trick in the relativity of the folders copy: [{src: 'assets', dest: '../mylib/assets'}], This will copy /src/assets into /dist/mylib/assets. So for dist task try to use dest setting

Thank you @Jagget. This was the issue for me.

squeral avatar May 13 '22 10:05 squeral