symfony / webpack-encore

A simple but powerful API for processing & compiling assets built around Webpack
https://symfony.com/doc/current/frontend.html
MIT License
2.23k stars 197 forks source link

Copy files without entries? #1140

Open CapInSpase opened 2 years ago

CapInSpase commented 2 years ago

Hi, I want to copy static files into a separate command, but I get an error when executing

No entries found! You must call addEntry() or addEntries() or addStyleEntry() or copyFiles() at least once - otherwise... there is nothing to webpack!

//config for copy static files

Encore
    .setOutputPath('public/assets/')
    .setPublicPath('/assetic')
    .setManifestKeyPrefix('assetic/')

    .disableSingleRuntimeChunk()
    .cleanupOutputBeforeBuild()
    .enableBuildNotifications()

    .addPlugin(new CopyWebpackPlugin({
        patterns: [
            { from: './assets/sites', to: '../sites', info: { minimized: true } },
            { from: './assets/bundles', to: '../bundles', info: { minimized: true } },
            { from: './assets/vendor', to: 'vendor', info: { minimized: true } },
        ]
    }))
;
const copyStaticConfig = Encore.getWebpackConfig();
copyStaticConfig.name = 'copyStaticConfig';
Encore.reset();

module.exports = [copyStaticConfig];

If use copyFiles() how to set multiply path and not minimized? https://symfonycasts.com/screencast/webpack-encore/copy-files

gimler commented 8 months ago

See Plugin docu https://webpack.js.org/plugins/copy-webpack-plugin/#skip-running-javascript-files-through-a-minimizer

For the Error i will Open a pull request in the next days i Run into the Same Problem 😁