> musicfree-desktop@0.0.5 start
> electron-forge start
✔ Checking your system
✔ Locating application
✔ Locating application
✖ Loading configuration
› ⨯ Unable to compile TypeScript:
forge.config.ts:51:7 - error TS2322: Type 'Configuration' is not assignable to type 'string | WebpackConfiguration'.
Type 'import("/home/daniel/node_modules/webpack/types").Configuration' is not assignable to type 'import("/home/daniel/coding/app/MusicFreeD…
Types of property 'entry' are incompatible.
Type 'string | string[] | (() => string | string[] | import("/home/daniel/node_modules/webpack/types").EntryObject | Promise<EntryStatic>) |…
Type '() => string | string[] | EntryObject | Promise<EntryStatic>' is not assignable to type 'string | string[] | (() => string | string[] …
Type '() => string | string[] | import("/home/daniel/node_modules/webpack/types").EntryObject | Promise<EntryStatic>' is not assignable to t…
Type 'string | string[] | import("/home/daniel/node_modules/webpack/types").EntryObject | Promise<EntryStatic>' is not assignable to type 's…
Type 'EntryObject' is not assignable to type 'string | string[] | EntryObject | Promise<EntryStatic>'.
Type 'EntryObject' is missing the following properties from type 'string[]': length, pop, push, concat, and 29 more.
51 mainConfig,
~~~~~~~~~~
node_modules/.store/@electron-forge+plugin-webpack@6.4.1/node_modules/@electron-forge/plugin-webpack/dist/Config.d.ts:118:5
118 mainConfig: WebpackConfiguration | string;
~~~~~~~~~~
The expected type comes from property 'mainConfig' which is declared here on type 'WebpackPluginConfig'
forge.config.ts:53:9 - error TS2322: Type 'Configuration' is not assignable to type 'string | WebpackConfiguration'.
53 config: rendererConfig,
~~~~~~
node_modules/.store/@electron-forge+plugin-webpack@6.4.1/node_modules/@electron-forge/plugin-webpack/dist/Config.d.ts:87:5
87 config: WebpackConfiguration | string;
~~~~~~
The expected type comes from property 'config' which is declared here on type 'WebpackPluginRendererConfig'
◼ Preparing native dependencies
◼ Running generateAssets hook
An unhandled rejection has occurred inside Forge:
TSError: ⨯ Unable to compile TypeScript:
forge.config.ts:51:7 - error TS2322: Type 'Configuration' is not assignable to type 'string | WebpackConfiguration'.
Type 'import("/home/daniel/node_modules/webpack/types").Configuration' is not assignable to type 'import("/home/daniel/coding/app/MusicFreeDesktop/node_modules/.store/webpack@5.96.1/node_modules/webpack/types").Configuration'.
Types of property 'entry' are incompatible.
Type 'string | string[] | (() => string | string[] | import("/home/daniel/node_modules/webpack/types").EntryObject | Promise<EntryStatic>) | import("/home/daniel/node_modules/webpack/types").EntryObject' is not assignable to type 'string | string[] | (() => string | string[] | import("/home/daniel/coding/app/MusicFreeDesktop/node_modules/.store/webpack@5.96.1/node_modules/webpack/types").EntryObject | Promise<...>) | import("/home/daniel/coding/app/MusicFreeDesktop/node_modules/.store/webpack@5.96.1/node_modules/webpack/types").EntryObject'.
Type '() => string | string[] | EntryObject | Promise<EntryStatic>' is not assignable to type 'string | string[] | (() => string | string[] | EntryObject | Promise<EntryStatic>) | EntryObject'.
Type '() => string | string[] | import("/home/daniel/node_modules/webpack/types").EntryObject | Promise<EntryStatic>' is not assignable to type '() => string | string[] | import("/home/daniel/coding/app/MusicFreeDesktop/node_modules/.store/webpack@5.96.1/node_modules/webpack/types").EntryObject | Promise<EntryStatic>'.
Type 'string | string[] | import("/home/daniel/node_modules/webpack/types").EntryObject | Promise<EntryStatic>' is not assignable to type 'string | string[] | import("/home/daniel/coding/app/MusicFreeDesktop/node_modules/.store/webpack@5.96.1/node_modules/webpack/types").EntryObject | Promise<EntryStatic>'.
Type 'EntryObject' is not assignable to type 'string | string[] | EntryObject | Promise<EntryStatic>'.
Type 'EntryObject' is missing the following properties from type 'string[]': length, pop, push, concat, and 29 more.
51 mainConfig,
~~~~~~~~~~
node_modules/.store/@electron-forge+plugin-webpack@6.4.1/node_modules/@electron-forge/plugin-webpack/dist/Config.d.ts:118:5
118 mainConfig: WebpackConfiguration | string;
~~~~~~~~~~
The expected type comes from property 'mainConfig' which is declared here on type 'WebpackPluginConfig'
forge.config.ts:53:9 - error TS2322: Type 'Configuration' is not assignable to type 'string | WebpackConfiguration'.
53 config: rendererConfig,
~~~~~~
node_modules/.store/@electron-forge+plugin-webpack@6.4.1/node_modules/@electron-forge/plugin-webpack/dist/Config.d.ts:87:5
87 config: WebpackConfiguration | string;
~~~~~~
The expected type comes from property 'config' which is declared here on type 'WebpackPluginRendererConfig'
at createTSError (/home/daniel/coding/app/MusicFreeDesktop/node_modules/.store/ts-node@10.9.2/node_modules/ts-node/src/index.ts:859:12)
at reportTSError (/home/daniel/coding/app/MusicFreeDesktop/node_modules/.store/ts-node@10.9.2/node_modules/ts-node/src/index.ts:863:19)
at getOutput (/home/daniel/coding/app/MusicFreeDesktop/node_modules/.store/ts-node@10.9.2/node_modules/ts-node/src/index.ts:1077:36)
at Object.compile (/home/daniel/coding/app/MusicFreeDesktop/node_modules/.store/ts-node@10.9.2/node_modules/ts-node/src/index.ts:1433:41)
at Module.m._compile (/home/daniel/coding/app/MusicFreeDesktop/node_modules/.store/ts-node@10.9.2/node_modules/ts-node/src/index.ts:1617:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
at Object.require.extensions.<computed> [as .ts] (/home/daniel/coding/app/MusicFreeDesktop/node_modules/.store/ts-node@10.9.2/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1288:32)
at Function.Module._load (node:internal/modules/cjs/loader:1104:12)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at exports.default (/home/daniel/coding/app/MusicFreeDesktop/node_modules/.store/@electron-forge+core@6.4.1/node_modules/@electron-forge/core/src/util/forge-config.ts:129:22)
at async Task.task (/home/daniel/coding/app/MusicFreeDesktop/node_modules/.store/@electron-forge+core@6.4.1/node_modules/@electron-forge/core/src/api/start.ts:63:29)
at async Task.run (/home/daniel/coding/app/MusicFreeDesktop/node_modules/.store/listr2@5.0.8/node_modules/listr2/dist/index.cjs:978:11)
at async /home/daniel/coding/app/MusicFreeDesktop/node_modules/.store/p-map@4.0.0/node_modules/p-map/index.js:57:22
前言
首先声明我不是做前端的,仅仅是想简单二开自用。目前的问题是代码克隆到本地后无法编译。
问题
系统环境
操作步骤(稳定复现)
最后一步出错:
问题分析
我看了一下electron-forge的源码,
WebpackConfiguration
是它自己内部从"webpack"的Configuration
封装出的一个类型,但是为什么不兼容呢?大佬能不能提示一下?