Search code examples
webpackcreate-react-app

Webpack Invalid configuration object. - 'globalObject' Create React App


This was all working fine, I had to reinstall npm run-all and now I'm getting this error:

 Invalid configuration object. Webpack has been initialised using a configuration object 
that does not match the API schema.
 - configuration.output has an unknown property 'globalObject'. 
These properties are valid:
   object { auxiliaryComment?, chunkFilename?, crossOriginLoading?, chunkLoadTimeout?, devtoolFallbackModuleFilenameTemplate?, devtoolLineToLine?, devtoolModuleFilenameTemplate?, filename?, hashDigest?, hashDigestLength?, 
hashFunction?, hashSalt?, hotUpdateChunkFilename?, hotUpdateFunction?, hotUpdateMainFilename?, jsonpFunction?, library?, libraryTarget?, libraryExport?, path?, pathinfo?, publicPath?, sourceMapFilename?, sourcePrefix?, strictModuleExceptionHandling?, umdNamedDefine? }

I'm setting the GlobalObject to this so that workers work in a Create React App via workerise-loader

I'm using react-app-rewired with the follow override:

module.exports = function override(config, env) {

  config.output.globalObject= `self`

  return config
}

How can I set the globalObject in Webpack?


Solution

  • Sccop had installed an old version of webpack