Error: Invalid schema object - webpack
See original GitHub issueHi everyone, when I compile my application with webpack get an error on console.
The problem is on this file workbox-build > build > options > partials > generate.js
in this lines of code:
.when('navigationPreload', { is: true, then: joi.required() }),
if remove this not have error in console.
Library Affected: workbox-build
Browser & Platform: all browsers
Console Error
Error: Invalid schema object at new module.exports (mypath/node_modules/@hapi/hoek/lib/error.js:23:19) at Object.module.exports [as assert] (mypath/node_modules/@hapi/hoek/lib/assert.js:20:11) at internals.Array.concat (mypath/node_modules/@hapi/joi/lib/types/any/index.js:143:14) at internals.Array.when (mypath/node_modules/@hapi/joi/lib/types/any/index.js:436:60) at Object.<anonymous> (mypath/node_modules/workbox-build/build/options/partials/generate.js:62:45) at Module._compile (internal/modules/cjs/loader.js:688:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10) at Module.load (internal/modules/cjs/loader.js:598:32) at tryModuleLoad (internal/modules/cjs/loader.js:537:12) at Function.Module._load (internal/modules/cjs/loader.js:529:3) at Module.require (internal/modules/cjs/loader.js:636:17) at require (internal/modules/cjs/helpers.js:20:18) at Object.<anonymous> (mypath/node_modules/workbox-build/build/options/schema/webpack-generate-sw.js:16:25) at Module._compile (internal/modules/cjs/loader.js:688:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10) at Module.load (internal/modules/cjs/loader.js:598:32) at tryModuleLoad (internal/modules/cjs/loader.js:537:12) at Function.Module._load (internal/modules/cjs/loader.js:529:3) at Module.require (internal/modules/cjs/loader.js:636:17) at require (internal/modules/cjs/helpers.js:20:18) at Object.<anonymous> (mypath/node_modules/workbox-webpack-plugin/build/generate-sw.js:20:33) at Module._compile (internal/modules/cjs/loader.js:688:30)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Okay, thanks for debugging this further.
I don’t know that there’s anything actionable that we can do on the Workbox side of things to prevent this behavior—it sounds more like
webpack-merge
is doing something that messes with the underlyingjoi
validation library dependency.I’m going to close this for now unless there’s something that comes up which we could be doing differently.
Hello @jeffposnick!
Ok after many attempts with a fresh installation, the problem seems the package “webpack-merge”, but it’s very strange because if I change order of import, GenerateSW don’t show errors.
from (show error)
to (work correctly)