请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

用electron-webpack启动项目出错

用electron-webpack启动项目出错:
warning “electron-webpack > mini-css-extract-plugin@0.9.0” has incorrect peer dependency “webpack@^4.4.0”.
warning “electron-webpack > webpack-cli@3.3.12” has incorrect peer dependency “webpack@4.x.x”.
warning " > electron-webpack@2.8.2" has incorrect peer dependency “webpack@^4.42.1”.
[4/4] Building fresh packages…
success Saved 1 new dependency.
info Direct dependencies
└─ electron-webpack@2.8.2
info All dependencies
└─ electron-webpack@2.8.2
Done in 6.43s.

D:\Software\electron_projects\demo_yarn2.1\demo_yarn>yarn start
yarn run v1.22.10
$ electron-webpack dev
┏ Renderer -------------------

AttachConsole failed with error 6: �������

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

  • configuration.optimization has an unknown property ‘namedModules’. These properties are valid:
    object { checkWasmTypes?, chunkIds?, concatenateModules?, emitOnErrors?, flagIncludedChunks?, innerGraph?, mangleExports?, mangleWasmImports?, mergeDuplicateChunks?, minimize?, minimizer?, moduleIds?, noEmitOnErrors?, nodeEnv?, portableRecords?, providedExports?, realContentHash?, removeAvailableModules?, removeEmptyChunks?, runtimeChunk?, sideEffects?, splitChunks?, usedExports? }
    -> Enables/Disables integrated optimizations.
    Did you mean optimization.moduleIds: “named” (BREAKING CHANGE since webpack 5)?
    这个是webpack版本不匹配造成的么,该如何解决呢?

正在回答 回答被采纳积分+3

1回答

张轩 2021-01-08 17:32:30

同学你好 你使用的这个 electron-webpack 项目的 github 地址是什么 发我一下 我看看

0 回复 有任何疑惑可以回复我~
  • 提问者 慕慕1545788 #1
    老师 我是看了一本电子书上教怎么在electron中使用webpack,首先我是全局安装了webpack后来又新建了一个最简单的electron工程然后在工程目录里使用控制台引入webpack以下为电子书的描述:4.1.2 配置webpack
    按照本书第2章内容新建一个项目,通过以下命令安装webpack和electron-webpack模块:
    > yarn add webpack --dev
    > yarn add electron-webpack --dev
    注意,这两个模块都是开发依赖,生产环境并不需要它们,所以在安装命令中都增加了--dev参数。
    接下来我们把package.json中的start命令修改一下,同时再增加一个build指令:
    "scripts": {
        "start": "electron-webpack dev",
        "build": "electron-webpack build"
    回复 有任何疑惑可以回复我~ 2021-01-08 21:23:57
  • 张轩 回复 提问者 慕慕1545788 #2
    把你现在的这个简单项目发给我吧 我在本地给你试试看
    回复 有任何疑惑可以回复我~ 2021-01-09 16:06:42
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信