Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run packaged app with tadeious or mssql package #3733

Open
3 tasks done
vasicvuk opened this issue Oct 8, 2024 · 8 comments
Open
3 tasks done

Cannot run packaged app with tadeious or mssql package #3733

vasicvuk opened this issue Oct 8, 2024 · 8 comments

Comments

@vasicvuk
Copy link

vasicvuk commented Oct 8, 2024

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.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

@jhonpedro
Copy link

Do you have electron rebuild installed?

@vasicvuk
Copy link
Author

No i don't have it installed, should I?

@jhonpedro
Copy link

try adding it and see if it changes something. I'm also having problem running the packaged version after installing native modules

@jhonpedro
Copy link

In my case, unfortunately, I had to change it to the webpack which solved the problem but made my build and start take a lot more time

@vasicvuk
Copy link
Author

I added it in package.json like this

    "rebuild": "electron-rebuild -f -w tedious"

and then run:

npm run rebuild
npm run package

When I run it i get the same issue

@jhonpedro
Copy link

In my case that _interopNamespaceDefault was being used to do something with the 'process' import. Is it the same for you?

Anyway, it might be worth changing to webpack just to make it work if you are in a hurry. Also it would be good to update the issue with a reproducible repo

@vasicvuk
Copy link
Author

Do you know the process of changing to webpack? Thanks

@jhonpedro
Copy link

For me I just created a new webpack template and started copying from that template to the original repo. It should be straightforward if you have a little experience with webpack. Besides that, I do not have a series of steps for you to follow, you'll need to change things and test if it works with the electron-forge startt command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants