Home > Enterprise >  copy webpack plugin error options has an unknown property 'to'
copy webpack plugin error options has an unknown property 'to'

Time:11-22

I am having issues with the Copy Webpack plugin. I have checked the documentation (https://webpack.js.org/plugins/copy-webpack-plugin/) and seems like I am using the correct config, still I am getting the error:

ValidationError: Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema. - options[0] has an unknown property 'to'.

Here is the config I am using as per link shared above. The from and to has been updated with my environment details.

import CopyPlugin from 'copy-webpack-plugin';

module.exports = {
  plugins: [
    new CopyPlugin({
      patterns: [
        { from: "source", to: "dest" },
        { from: "other", to: "public" },
      ],
    }),
  ],
};

I am using copy-webpack-plugin package version ^11.0.0 and webpack package version ^5.74.0

Anyone seen this issue before?

CodePudding user response:

All was done correct as per original post. The Babel config was missing. To fix this also check your Babel config and be sure the same is being done there.

  • Related