Invalid options object. Dev Server has been initialized using an options object that does not match

Invalid options object. Dev Server has been initialized using an options object that does not match

  • 错误详细信息一
  • 错误详细信息二

错误详细信息一

Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
- options has an unknown property ‘watchContentBase’. These properties are valid:
object { allowedHosts?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, http2?, https?, ipc?, liveReload?, magicHtml?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, server?, setupExitSignals?, setupMiddlewares?, static?, watchFiles?, webSocketServer? }

  • 问题原因
    1. webpack 不识别 watchContentBase
    2. 猜测你想配置的是 watch, 默认 watch:true
  • 解决建议
    1. 将 watchContentBase 配置 修改为 watch,详细配置 请参考webpack官方文档

错误详细信息二

Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.

  • configuration.output has an unknown property ‘jsonpFunction’. These properties are valid:
    object { assetModuleFilename?, asyncChunks?, auxiliaryComment?, charset?, chunkFilename?, chunkFormat?, chunkLoadTimeout?, chunkLoading?, chunkLoadingGlobal?, clean?, compareBeforeEmit?, crossOriginLoading?, cssChunkFilename?, cssFilename?, devtoolFallbackModuleFilenameTemplate?, devtoolModuleFilenameTemplate?, devtoolNamespace?, enabledChunkLoadingTypes?, enabledLibraryTypes?, enabledWasmLoadingTypes?, environment?, filename?, globalObject?, hashDigest?, hashDigestLength?, hashFunction?, hashSalt?, hotUpdateChunkFilename?, hotUpdateGlobal?, hotUpdateMainFilename?, iife?, importFunctionName?, importMetaName?, library?, libraryExport?, libraryTarget?, module?, path?, pathinfo?, publicPath?, scriptType?, sourceMapFilename?, sourcePrefix?, strictModuleErrorHandling?, strictModuleExceptionHandling?, trustedTypes?, umdNamedDefine?, uniqueName?, wasmLoading?, webassemblyModuleFilename?, workerChunkLoading?, workerWasmLoading? }
    -> Options affecting the output of the compilation. output options tell webpack how to write the compiled files to disk.
    Did you mean output.chunkLoadingGlobal (BREAKING CHANGE since webpack 5)?
    • 问题原因
      1. webpack5 废弃了 jsonpFunction,改为 chunkLoadingGlobal
    • 修改方案
      1. jsonpFunction 配置修改为 chunkLoadingGlobal

你可能感兴趣的:(项目踩坑,webpack,前端,javascript)