Getting Error from webpack-cli: “TypeError: merge is not a function” in webpack config

You are importing merge incorrectly. Try it like this: const { merge } = require(‘webpack-merge’); UPD: Based on the following changelog, starting with webpack-merge 5.0.3 and higher, you should use the code I provided above. If the version is lower than 5.0.3, then you need to use: const merge = require(‘webpack-merge’);

Webpack 4 migration CommonsChunkPlugin

As of webpack v4 the CommonsChunkPlugin is deprecated. We have deprecated and removed CommonsChunkPlugin, and have replaced it with a set of defaults and easily overridable API called optimization.splitChunks. webpack.optimize.CommonsChunkPlugin has been removed, please use config.optimization.splitChunks instead. Deprecated You no longer need to use these plugins: DedupePlugin has been removed too in v4 NoEmitOnErrorsPlugin -> … Read more

Can’t import SVG into Next.js

You need to provide a webpack loader that will handle SVG imports, one of the famous one is svgr. In order to configure it to work with next, you need to add to your next.config.js file the usage of the loader, like that: // next.config.js module.exports = { webpack(config) { config.module.rules.push({ test: /\.svg$/, issuer: { … Read more

Webpack 4 – create vendor chunk

In order to reduce the vendor JS bundle size. We can split the node module packages into different bundle files. I referred this blog for splitting the bulky vendor file generated by Webpack. Gist of that link which I used initially: optimization: { runtimeChunk: ‘single’, splitChunks: { chunks: ‘all’, maxInitialRequests: Infinity, minSize: 0, cacheGroups: { … Read more

Webpack 4 – How to configure minimize?

It’s not possible to modify the default configuration. You can use the optimization.minimizer setting to instantiate your own UglifyJsPlugin, however. Using 4.0 we used this example to get source maps even when mode is set to ‘production’ for example (no longer necessary as of 4.1.1): const UglifyJsPlugin = require(‘uglifyjs-webpack-plugin’); module.exports = { optimization: { minimizer: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)