angular-builders icon indicating copy to clipboard operation
angular-builders copied to clipboard

Adding custom CopyPlugin pattern will overwrite assets to copy defined in angular.json

Open dsnoeck opened this issue 4 years ago • 0 comments

Describe the Bug

When using the webpack CopyPlugin in custom webpack configuration for building app, it overwrite the assets defined in angular.json (/projects/production-orders-web-client/architect/build/options/assets)

Minimal Reproduction

  1. Create a fresh app: ng new <my-app>
  2. Add dependency for Angular 8: npm i @angular-builders/custom-webpack@8 -D
  3. Add at the root a custom-webpack.config.js file with:
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');

module.exports = {
  plugins: [new CopyPlugin(
    [{
      from: path.join(__dirname, 'src', 'test-0.txt'),
      to: 'test-0.txt'
    }]
  )]
};
  1. Add in angular.json, in /projects/test-copy/architect/build/options
"customWebpackConfig": {
  "path": "./custom-webpack.config.js"
}
  1. Add test file to copy in src: touch src/test-0.txt
  2. Add test file to copy in assets: touch src/assets/test-1.txt
  3. Run: ng build

Expected Behavior

Expected copied file dist:

- assets/test-1.txt
- favicon.ico
- test-0.txt

Actual copied file dist:

- assets/test-1.txt
- test-0.txt

Environment


Libs
- @angular/core version: 8.2.14
- @angular-devkit/build-angular version: 0.803.26
- @angular-builders/custom-webpack version: 8.4.1,

For Tooling issues:
- Node version: 12.13.0
- Platform:  Mac

dsnoeck avatar May 11 '20 18:05 dsnoeck