Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript React/Webpack-从Webpack 1迁移到4,配置对象无效_Javascript_Node.js_Reactjs_Webpack - Fatal编程技术网

Javascript React/Webpack-从Webpack 1迁移到4,配置对象无效

Javascript React/Webpack-从Webpack 1迁移到4,配置对象无效,javascript,node.js,reactjs,webpack,Javascript,Node.js,Reactjs,Webpack,已经有一个帖子出现了与我类似的问题,但它的解决方案对我没有帮助: 我有以下错误: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration has an unknown property 'postcss'. These properties are valid: ob

已经有一个帖子出现了与我类似的问题,但它的解决方案对我没有帮助:

我有以下错误:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration has an unknown property 'postcss'. These properties are valid:
   object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, externals?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, serve?, stats?, target?, watch?, watchOptions? }
   For typos: please correct them.
   For loader options: webpack >= v2.0.0 no longer allows custom properties in configuration.
     Loaders should be updated to allow passing options via loader options in module.rules.
     Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:
     plugins: [
       new webpack.LoaderOptionsPlugin({
         // test: /\.xxx$/, // may apply this only for some modules
         options: {
           postcss: …
         }
       })
     ]
 - configuration.module has an unknown property 'loaders'. These properties are valid:
   object { defaultRules?, exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, noParse?, rules?, strictExportPresence?, strictThisContextOnImports?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp? }
   -> Options affecting the normal modules (`NormalModuleFactory`).
 - configuration.resolve has an unknown property 'modulesDirectories'. These properties are valid:
   object { alias?, aliasFields?, cachePredicate?, cacheWithContext?, concord?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, resolver?, symlinks?, unsafeCache?, useSyncFileSystemCalls? }
   -> Options for the resolver
My
production.config.js
--

(很抱歉使用codepen,编辑器诅咒的语法)

My
package.json
--

我已经尝试将
postsss
modules
传输到
plugins
,但错误依然存在


老实说,我参加了一些网页研讨会,但我仍然没有理解我在这段代码中做错了什么。我将非常感谢您的任何建议或帮助

第一个问题通过在
default.config

第二个问题通过这个帖子解决了:


第三个问题通过将
default.config

中的“modulesDirectories”重命名为“modules”解决了。您是否查看了default.configyes,postss在其中声明了这就是错误所抱怨的,删除后尝试运行是的,您是对的,它决定了三分之一,非常感谢!第三个问题通过将“modulesDirectories”重命名为“modules”得到解决,ty Tom,c你能写一个答案让我投赞成票吗?:)