electron / electron/forge

Cannot run packaged app with tadeious or mssql package

Open
#3,733 9 comments 3 reactions 0 assignees View on GitHub
bug plugin/vite
Dominant language
TypeScript
Stars
7.1k
Forks
641
Avg merge
3d 1h
Merged PRs (30d)
30

Description

### Pre-flight checklist

- [x] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [x] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project uses.
- [x] I have searched the issue tracker for a bug that matches the one I want to file, without success.

### Electron Forge version

7.5.0

### Electron version

v32.1.2

### Operating system

Windows 11

### Last known working Electron Forge version

_No response_

### Issue

I'm encountering issues with packaging my Electron app using Electron Forge, especially regarding including the `mssql` module. The module works fine in the development environment but fails to load in the packaged version. Additionally, I have tried using the `tedious` package, and I am running into similar issues.

I started creating the app using vite-typescript template.

The errors vary depending on the configuration:

1. **Without marking `mssql` as external in `vite.config.js`:**
In this case, the development version fails to run, giving the following error:
```TypeError: Cannot read properties of undefined (reading 'get') at _interopNamespaceDefault```
2. **With marking `mssql` as external in `vite.config.js`:**
The development version works, but when I package the app using Electron Forge, I get the following error when trying to start the app:
```Error: Cannot find module 'mssql'```

I also tried disabling `asar` and `contextIsolation` but that does not help.

How do you get some of these packages running?

### Actual behavior

The app does not run in packaged mode when this packaged are used.

### Steps to reproduce

- Create a project with typescript-vite template
- Add sample page communicating to MSSQL server over Bridge
- Run the app
- Error appears

### Additional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.