chladog / payload-webp

payloadcms/payload plugin for automatic image conversion to webp format.
https://www.npmjs.com/package/payload-webp
GNU General Public License v3.0
45 stars 5 forks source link

TypeError: Cannot read properties of undefined (reading 'webpack') #6

Closed Etheliene closed 2 years ago

Etheliene commented 2 years ago

After installation I get the following Error:

TypeError: Cannot read properties of undefined (reading 'webpack')
\payload-webp\lib\Plugin.js:273
var incomingWebpackConfig = this.payloadConfig.admin.webpack;

Switching from this:

var incomingWebpackConfig = this.payloadConfig.admin.webpack;
if (!this.payloadConfig.admin) {
  this.payloadConfig.admin = {};
}

to:

if (!this.payloadConfig.admin) {
  this.payloadConfig.admin = {};
}
var incomingWebpackConfig = this.payloadConfig.admin.webpack;

seems to solve the issue.

Payload v. 1.0.27 payload-webp: 1.0.26