pcb icon indicating copy to clipboard operation
pcb copied to clipboard

Terser Plugin issue while building with webpack-cli

Open dannycoulombe opened this issue 2 years ago • 3 comments

Whenever I try to build this project, using laravel-mix 6.0.6, I get the following error:

[webpack-cli] Invalid options object. Terser Plugin has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'minimizer'. These properties are valid:
   object { test?, include?, exclude?, terserOptions?, extractComments?, parallel?, minify? }

My webpack config is pretty straightforward:

.webpackConfig({
        devtool: 'source-map',
        plugins: [
            new webpack.DefinePlugin({
                'process.env': {
                    API_URL: JSON.stringify(process.env.API_URL),
                },
            }),
            new OfflinePlugin({
                appShell: '/',
                autoUpdate: 1000 * 60 * 60, // one hour
                externals: [
                    '/',
                ]
            }),
        ],
        devServer: {
            port: 8079,
        },
        resolve: {
            alias: {
                '@': path.resolve('resources/app')
            }
        }
    })

I am importing OfflinePlugin this way:

const OfflinePlugin = require('@lcdp/offline-plugin');

Anybody experiencing the same issue? I tried to downgrade to multiple versions without any success. I am now on version 5.0.7.

dannycoulombe avatar May 04 '22 10:05 dannycoulombe

I'm facing this issue with webpack-cli

When I run npm run build, the above issue comes up.

I'm using webpack 5.75.0 offline-plugin 5.0.7 terser-webpack-plugin 5.3.6

rishu605 avatar Nov 11 '22 11:11 rishu605

The same here, but in Symfony (webpack-encore in all versions above 1.0.0).

The problem is that the offline-plugin is not compatible with terser-webpack-plugin in version 5

secit-pl avatar Dec 13 '22 12:12 secit-pl

Any workaround?

brandoncollins7 avatar May 31 '23 14:05 brandoncollins7