rauschma / tackling-ts

9 stars 0 forks source link

Chapter: Creating web apps via TypeScript and webpack #9

Open rauschma opened 4 years ago

tuf75588 commented 3 years ago

Hello Dr. Rauschmayer @rauschma !

I wanted to let you know of a small error I found in Chapter 9 and more specifically section 9.10. In the code snippet for the webpack.config.js file, the constructor function new CopyWebpackPlugin() as laid out in the book will produce a Webpack error informing the user that the arguments to this function do not match what Webpack expects them to be.

I did some searching through the plugins changelog and it appears this was a change to the API made back in May of last year

The function now expects an object instead of an array, with a required patterns key and an array as its value.

const CopyPlugin = require("copy-webpack-plugin");

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

Just wanted to make you aware of this change and thank you for so much detail and hard work put into book, I've really enjoyed working through the material!