Skip to content

Missing ts-node and esbuild-register as optional peer dependencies #3609

Open

Description

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

7.4.0

Electron version

30.0.8

Operating system

Windows 11

Last known working Electron Forge version

No response

Expected behavior

No error

Actual behavior

✔ Checking your system
✔ Locating application                                                                                                                                                           
✖ Loading configuration                                                                                                                                                          
  › Unable to use specified module loaders for ".ts".                                                                                                                            
◼ Preparing native dependencies                                                                                                                                                  
◼ Running generateAssets hook                                                                                                                                                    

An unhandled rejection has occurred inside Forge:
Error: Unable to use specified module loaders for ".ts".
at exports.prepare (C:\workspace\AppData\Local\Yarn\Berry\cache\rechoir-npm-0.8.0-fb660b3bc8-10c0.zip\node_modules\rechoir\index.js:58:11)
    at exports.default (C:\workspace\AppData\Local\Yarn\Berry\cache\@electron-forge-core-npm-7.4.0-4c33fc0cff-10c0.zip\node_modules\@electron-forge\core\dist\util\forge-config.js:123:25)
    at async C:\workspace\AppData\Local\Yarn\Berry\cache\@electron-forge-core-npm-7.4.0-4c33fc0cff-10c0.zip\node_modules\@electron-forge\core\dist\api\start.js:44:35       
    at async _Task.taskFn (C:\workspace\AppData\Local\Yarn\Berry\cache\@electron-forge-tracer-npm-7.4.0-9f71f99d40-10c0.zip\node_modules\@electron-forge\tracer\dist\index.js:58:20)
    at async _Task.run (C:\workspace\AppData\Local\Yarn\Berry\cache\listr2-npm-7.0.2-42ddc71dba-10c0.zip\node_modules\listr2\dist\index.cjs:2063:11)

Steps to reproduce

  • yarn init -y
  • yarn set version berry
  • yarn add -D @electron-forge/cli @electron-forge/plugin-vite electron typescript vite
  • Create an empty forge.config.ts file
  • yarn electron-forge start

Additional information

If ts-node is installed as dev dependency, the error disappear.
ts-node should be added in package.json (in electron-forge/* and, if it's a transitive peer dependency, in electron) as an optional peer dependency.

Notes

The issue appears only with forge.config.ts and not with forge.config.js.

Related issue #3499

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions