Comments (14)
@ahadcove Your JS files must be inside a directory (not just sitting in the top level of your app). I.e. If you move main.js
to be somewhere like src/main.js
and update your package.json accordingly the packaged version will work.
/cc @malept We should probably catch this issue ourselves
from forge.
- Does it work with a simple
electron-forge start
- How are you requiring
main.js
, is it your entry point?
from forge.
Well when I use START the same thing is happening when I was using electron-packager: A static index.html with the loading text that I have when starting up my electron app for the first time.
It suppose to route to my home as soon as it starts though as it does when I have a simple ng build.
I am requiring main.js as my entry point.
in my Package.json the main field is:
"main":"main.js"
from forge.
I switched the directories and everything and it does get past the error. I am still running into the static index.html though.
For some reason, I just can't figure out how to make my App work all packaged up
from forge.
@ahadcove I am not too familiar with the intricacies of Angular 2, can you explain what you mean by "static index.html". I don't quite understand the issue you are having.
from forge.
Well my original problem was that when I run my project with ng build or ng serve it works 100% all the routers and everything just works.
It was when I started trying to package up my app with electron-packager, builder, and forge where I get the routes no longer working. Instead of loading up the Index.html then immediately navigating to my home component it stays at the index.
from forge.
This sounds familiar from an Electron issue. I believe it is due to how in Electron your Angular app is served from a file://
url which angular routers do not like or expect.
from forge.
Hmmm That sounds like where my problem may lie, but Why would it work with ng serve and build?
from forge.
@ahadcove ng serve
runs a localhost server I believe, so it will be served over something like http://localhost:1234
from forge.
Okay so it may have something to do with Hash Locations or something
I will dig a little deeper. I may come back to forge later when I figure this out. Thanks for everything
from forge.
@ahadcove FWIW this is not a -forge
or -packager
issue, it is purely an issue with Angular 2 in Electron in general.
This might help you out
electron/electron#6799 (comment)
It looks like you need
document.write('<base href="file://' + __dirname + '/"/>');
To use a router in Angular in Electron
from forge.
Yes, I have that in my index.html already. That is what get's routers working. I have a fully working angular 2 Electron app already, its just when I package it with anything it no longer functions how it should be
from forge.
Is the app public, I'm happy to dive into it and see what's going on?
from forge.
Sadly, it's not. I'm going to keep picking away at it though. I definitely like the idea of forge though so I may be back when I get this figured out. Thank you for everything
from forge.
Related Issues (20)
- Feature Request: preStart simple hook HOT 2
- When making a folder using Electron-forge, after installing the exe file, a green boot page will pop up. How to close it? HOT 7
- @electron-forge/publisher-electron maker.clone is not a function HOT 1
- An error is reported after vue is imported HOT 8
- Error during packaging on macOS HOT 10
- The installation of the package printed by electron forge failed
- fix(cli): add descriptive error for node version mismatch
- How to pass environment variables to build ? HOT 5
- [Bug] An error when trying to install forge during import HOT 2
- Plugins are ignored and nothing runs after the generateAssets hook HOT 1
- Unable to package app on macOS using vite-typescript + typeorm library HOT 1
- Codesigning works on M* Mac but not on Intel Mac HOT 2
- @electron-forge/maker-zip don't have v7.4.0, but it install it HOT 2
- Update maker docs or defaults to Fiddle's config HOT 2
- error Couldn't find any versions for "@electron-forge/maker-zip" that matches "^7.4.0" HOT 2
- error when running make/package
- Add option to Vite plugin to filter copied dependencies HOT 10
- Cannot make with latest forge version HOT 3
- Weird PublisherGithub issues with gh action when running `electron-forge publish --arch=arm64,x64` to build macos arm and x64 intel at same time HOT 4
- The 'path' argument must be of type string. Received undefined HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from forge.