Copy files to build directory using Copy webpack plugin.
npm install --save-dev @easy-webpack/config-copy-files
easy-webpack is also required.
// webpack.config.js
const generateConfig = require('@easy-webpack/core').generateConfig;
const baseConfig = { ... }; // project-specific config like the entry file
module.exports = generateConfig(
baseConfig,
require('@easy-webpack/config-copy-files')
([
/* Array of patterns object */
{ from: 'favicon.ico' },
{ from: 'robots.txt' },
{ from: 'src/locals', to: 'locals' }
], {
/* Options object */
copyUnmodified: true
})
);
Patterns object is identical to pattern properties in copy webpack plugin.
Options object is identical to options in copy webpack plugin.
Note: this config will NOT modify context
options in webpack config.
Therefore all from
paths are relative to the webpack.config.js
file.