Electron-forge with webpack devServer - electron

I have created an app with electron-forge using npx create-electron-app electron --template=webpack.
I then did npm install webpack-dev-server
In my webpack.renderer.config.js I started to add a devServer section with proxy and before sections, but when I use npm run start these are ignored.
npm run start runs electron-forge start and that's where I think the problem is as I do not have direct access to the webpack call so as to get webpack serve ...
What is needed to get the webpack dev-server running with electron?

webpack-dev-server is already used by Electron-Forge, as indicated in Electron-forge Webpack documentation
In development we spin up webpack-dev-server instances to power your renderer processes, in prod we just build the static files.
For renderer : it refresh for you.
For main, as indicated in the documentation, you have to type "rs" in the terminal to "reload" the app.
For the main process, just type rs in the console you launched electron-forge from and we will restart your app for you with the new main process code.
If you want to access the webpack log server : http://localhost:9000/ (9000 is the default loggerPort in plugins-webpack config)
// forge.config.js (or package.json)
plugins: [
['#electron-forge/plugin-webpack',
{
// Renderer server port
port: 3000,
// Webpack logger port
loggerPort: 9000,
mainConfig: './webpack...',
...
}
],

Related

How to run dart server on background?

how to run my dart server forever when terminal is closed? Is there any package like pm2
I use for node js:
pm2 start index.js
You can do the some in dart, what you need is the to run your dart program entry point let saya pm2 start main.dart you can add other pm2 arguments options as per https://pm2.keymetrics.io/docs/usage/quick-start/

Expo Classic/Turtle CLI standalone and offline iOS build still trying to contact development server: "Could not connect to development server"

I am using Expo Classic and Turtle CLI to make local standalone iOS builds of my React Native app.
I want my app to be “offline”: not do over the air updates, have all assets bundled with it, and generally have everything needed bundled into the simulator or binary build and not reach out to any servers to run the app.
I have been referencing the following Expo pages to create this type of build:
"Building Standalone Apps on Your CI"
"Hosting Updates on Your Servers"
"Offline Support"
My understanding from the Expo documentation is that while I need to run a local server to build my app locally, I shouldn’t need this server to be running after the build is done if I configure my app to not do over the air updates and have bundled assets. I am using the following settings in my app.json file to accomplish this:
"expo": {
"updates": {
"enabled": false,
"checkAutomatically": "ON_ERROR_RECOVERY"
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"assets/*"
]
}
The problem is that after I finish my build, kill my local server, and install/run my build in either the iOS Simulator or binary build on a device, I immediately see an error message that says “Could not connect to development server” rather than my app loading. The problem doesn’t happen if I keep my local server that I used to create the build running.
Am I misunderstanding the documentation and it is not possible to have a totally standalone build with all required files/assets bundled? Or are the app.json settings not actually working as expected?
This is how I am making my build:
From the expo project folder run: expo export --public-url http://MY.IP.ADDRESS:8000 1 --dev
dist directory is successfully created.
From the dist directory run: python -m SimpleHTTPServer 8000
From the project folder run:
EXPO_IOS_DIST_P12_PASSWORD=MY.PASSWORD
turtle build:ios
–team-id MY.TEAM.ID
–dist-p12-path …/…/Certificates.p12
–provisioning-profile-path …/…/…/Downloads/PROJECT_Ad_Hoc_Provisioning_Profile.mobileprovision
–allow-non-https-public-url
–public-url http://MY.IP.ADDRESS:8000/ios-index.json
Build binary is successfully created.
Kill server running on port 8000.
Install and run build; see error, app will not load.
Restart server on port 8000 and run build; app will load.

Electron package no window

I run electron-packager to make a distributable from my app, but when I start the App.app, no window is shown, only the top menu.
Question: How do I best debug / troubleshoot this?
The app starts a web server and makes a tcp connection to another server. The html for the electron app is served from the local web server.
This is the output when building:
$ npx electron-packager ./ App --overwrite
Packaging app for platform darwin x64 using electron v1.8.4
Wrote new app to /Users/user/www/app/App-darwin-x64
I tried to run the node app manually in package, but got this:
$ cd App-darwin-x64/App.app/Contents/Resources/app/
$ npm start
electron not found
From package.json:
"devDependencies": {
"electron": "^1.8.4",
"electron-packager": "^12.0.1"
},
$ node -v
v8.11.1
You can't run the app like that, you need to run it without the Content/Resources/app, as thats not where its stored. You need to run it from App-darwin-x64/App.app. You also don't call npm-start, as that's only called for running in dev.
Maybe try having a look at some example electron apps with build processes, try electron-vue as that has some good examples

Can't run webpack in rails project

I'm trying to run the rails application https://github.com/lumenlearning/OpenAssessments on a linux server. I've been able to get most aspects of it working, but I can't get webpack to run correctly. The project readme states to run the following commands:
$ npm install -g webpack
$ cd client && webpack
Webpack installs correctly, but when I run it as stated, I just get the webpack usage help. I assume this is because there is no webpack.config.js file in the client directory. There is, however, one in client/config: https://github.com/lumenlearning/OpenAssessments/blob/master/client/config/webpack.config.js
If I run webpack in client/config, then webpack is able to find the config file, but I get the following error:
Config did not export an object.
Should I be running webpack in a different way? I am very new to webpack.
Thanks!

Yeoman: EACCES error running karma unit test for Angularjs

I'm following the sample Yeoman workflow listed on yeoman.io:
npm install -g generator-angular generator-karma # install generators
yo angular # scaffold out a AngularJS project
bower install angular-ui # install a dependency for your project from Bower
*grunt test # test your app
grunt server # preview your app
grunt # build the application for deployment
Everything works great except the grunt test command:
C:\yeoman2>grunt test
(logging omitted for brevity)
Running "connect:test" (connect) task
Starting connect web server on localhost:9000.
Running "karma:unit" (karma) task
Fatal error: listen EACCES
I haven't updated my gruntfile or made any other modifications to the configs. Has anyone seen this EACCESS error before? I'm on Windows 8, with a fresh node install.
This was happening because the karma server was running on port 8080. I changed it (in karma.conf.js) to 9999 and all is well.

Resources