[英]configuration.module.rules[2] Issue in @electron-forge/plugin-webpack
Here is some info about the machine I'm using:以下是有关我正在使用的机器的一些信息:
I'm trying to get my project here at: https://github.com/Cokaps/GenZOC working but I've ran to this issue:我试图让我的项目在这里: https://github.com/Cokaps/GenZOC工作,但我遇到了这个问题:
When I run electron-forge start, it shows an error here:当我运行 electron-forge start 时,这里显示错误:
PS D:\GenZOC> yarn start
✔ Checking your system
✔ Locating Application
✔ Preparing native dependencies: 1 / 1
✔ Compiling Main Process Code
✖ Launch Dev Servers
An unhandled error has occurred inside Forge:
Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.module.rules[2] should be one of these:
["..." | object { compiler?, dependency?, descriptionData?, enforce?, exclude?, generator?, include?, issuer?, issuerLayer?, layer?, loader?,
mimetype?, oneOf?, options?, parser?, realResource?, resolve?, resource?, resourceFragment?, resourceQuery?, rules?, scheme?, sideEffects?, test?, type?, use? }, ...]
-> A rule.
Details:
* configuration.module.rules[2] should be "...".
* configuration.module.rules[2] should be an object:
object { compiler?, dependency?, descriptionData?, enforce?, exclude?, generator?, include?, issuer?, issuerLayer?, layer?, loader?, mimetype?, oneOf?, options?, parser?, realResource?, resolve?, resource?, resourceFragment?, resourceQuery?, rules?, scheme?, sideEffects?, test?, type?, use? }
-> A rule description with conditions and effects for modules.
ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.module.rules[2] should be one of these:
["..." | object { compiler?, dependency?, descriptionData?, enforce?, exclude?, generator?, include?, issuer?, issuerLayer?, layer?, loader?,
mimetype?, oneOf?, options?, parser?, realResource?, resolve?, resource?, resourceFragment?, resourceQuery?, rules?, scheme?, sideEffects?, test?, type?, use? }, ...]
-> A rule.
Details:
* configuration.module.rules[2] should be "...".
* configuration.module.rules[2] should be an object:
object { compiler?, dependency?, descriptionData?, enforce?, exclude?, generator?, include?, issuer?, issuerLayer?, layer?, loader?, mimetype?, oneOf?, options?, parser?, realResource?, resolve?, resource?, resourceFragment?, resourceQuery?, rules?, scheme?, sideEffects?, test?, type?, use? }
-> A rule description with conditions and effects for modules.
at validate (D:\GenZOC\node_modules\schema-utils\dist\validate.js:104:11)
at validateSchema (D:\GenZOC\node_modules\webpack\lib\validateSchema.js:78:2)
at create (D:\GenZOC\node_modules\webpack\lib\webpack.js:109:24)
at webpack (D:\GenZOC\node_modules\webpack\lib\webpack.js:151:32)
at f (D:\GenZOC\node_modules\webpack\lib\index.js:55:16)
at D:\GenZOC\node_modules\@electron-forge\plugin-webpack\src\WebpackPlugin.ts:296:24
at processTicksAndRejections (internal/process/task_queues.js:95:5)
In my repo (link above), the config for electron forge is /forge.config.js
, /webpack.js
for main process and /webpack.renderer.js
is for renderer.在我的仓库(上面的链接)中,electron forge 的配置是
/forge.config.js
, /webpack.js
用于主进程, /webpack.renderer.js
用于渲染器。 Is there anyway to fix this.有没有什么办法解决这一问题。 I appreciate your help.
我感谢您的帮助。 Thanks
谢谢
Edit: When I change rules.push
in webpack.renderer.js to comment, it work but I want to find a fix for this.编辑:当我在 webpack.renderer.js 中更改
rules.push
以进行评论时,它可以工作,但我想找到一个解决方法。
Did you try loading like this in webpack.renderer.js:您是否尝试在 webpack.renderer.js 中像这样加载:
const nativeRules = require('./webpack.rules.js');
// ...
module: {
rules: [
nativeRules,
// other rules that you want to load
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.