vue electron builder blank page - vue.js

How I came to the problem:
I setup an project like this:
https://www.smashingmagazine.com/2020/07/desktop-apps-electron-vue-javascript/
until it came up to the coding part, there I added custom stuff. Created Components and so on. Everything works fine in serve then I want to build it.
What I expect as outcome:
App working as in serve mode
What I got:
blank page
What I've tried to fix the problem:
change a wide range of path urls like:
win.loadURL(url.format({
pathname: path.join(__dirname, '../public/index.html'),
protocol: 'file:',
slashes: true
})) // with different links passing different index.html files (raw vue build, electron build and public)
win.loadURL('app://./index.html')
win.loadURL(`file://${__dirname}/../public/index.html`) // aswell as the variation without file protocoll
Problem is I dont get errors. If I open developer console at the end of the building process by the menu bar it says, that I have to reload the page that the console is attached to the program, when I press reload, nothing happens.
Any suggestions to go further?
edit: here are my dependecies:
"dependencies": {
"axios": "^0.20.0",
"core-js": "^3.6.5",
"jquery": "^3.5.1",
"vue": "^3.0.0"
},
"devDependencies": {
"#vue/cli-plugin-babel": "~4.5.0",
"#vue/cli-plugin-eslint": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"#vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0",
"electron": "^9.0.0",
"electron-devtools-installer": "^3.1.0",
"electron-icon-builder": "^1.0.2",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0-0",
"vue-cli-plugin-electron-builder": "~2.0.0-rc.4",
"webpack-cli": "^4.0.0"
},

So after many hours of struggling because I couldnt open a working console I found a tool called Debugtron. After a bit of optimization it throwed the error:" createProtocol is undefined ".
The autogenerated background.js missed the line:
import createProtocol from "vue-cli-plugin-electron-builder/lib/createProtocol";

Related

Vue - npm run serve command crashes because of webpack version (vue-cli-service, laravel-mix, webpack)

to explain my problem, I will start by saying that I am currently making a system in Vue with backend API Laravel (irrelevant). I am making them as 2 separate projects. My problem is in the frontend Vue part. I created it using Vue CLI.
Here is my package.json file:
"dependencies": {
"#popperjs/core": "^2.9.3",
"axios": "^0.21.1",
"bootstrap": "^5.1.0",
"core-js": "^3.6.5",
"dotenv": "^10.0.0",
"vue": "^3.0.0",
"vue-axios": "^3.2.5",
"vue-plugin-load-script": "^2.0.1",
"vue-router": "^4.0.11",
"vuex": "^4.0.2",
"vuex-persistedstate": "^4.0.0"
},
"devDependencies": {
"#vue/cli-plugin-babel": "~4.5.0",
"#vue/cli-plugin-eslint": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"#vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0",
"laravel-mix": "^6.0.31",
"prettier": "^2.2.1",
"resolve-url-loader": "^4.0.0",
"sass": "^1.38.1",
"sass-loader": "^12.1.0",
"webpack": "^5.52.1"
}
As you can see I am using laravel-mix (specifically to use the npm run dev command).
So to use laravel-mix I also needed to install webpack.
Now the problem arises at the point when I try to run npm run serve command to start the app. I get this error:
Error: module property was removed from Dependency (use compilation.moduleGraph.updateModule(dependency, module) instead)
And I have found 1 solution which was to use webpack 4 instead of 5, which kind of did not work, because when I use webpack 4 I can run "npm run serve" but when I run "npm run dev", it does not mix my assets. No error, only the command is parsed but nothing else.
I really did not find any solution, other than switch webpack version, however the asset mixing part is really cruical in the project.
Update 1:
Here is my webpack.mix.js
let mix = require("laravel-mix");
mix.sass('src/assets/sass/style.scss', 'src/assets/sass')
.styles([
'src/assets/template/css/datatables.min.css',
'src/assets/template/css/rowGroup.dataTables.min.css',
'src/assets/template/css/fullcalendar.min.css',
'src/assets/template/css/select2.min.css',
'src/assets/template/css/bootstrap-colorpicker.min.css',
'src/assets/template/css/bootstrap-datepicker.min.css',
'src/assets/template/css/bootstrap.min.css',
'src/assets/template/css/icons.min.css',
'src/assets/template/css/app.min.css',
'src/assets/sass/style.css'
], 'public/css/style.css')
.scripts([
'src/assets/template/js/jquery.min.js',
'src/assets/template/js/bootstrap.min.js',
'src/assets/template/js/metismenu.min.js',
'src/assets/template/js/simplebar.min.js',
'src/assets/template/js/node-waves.min.js',
'src/assets/template/js/waypoints.min.js',
'src/assets/template/js/jquery-counterup.min.js',
'src/assets/template/js/datatables.min.js',
'src/assets/template/js/dataTables.rowGroup.min.js',
'src/assets/template/js/moment.min.js',
'src/assets/template/js/jquery-ui-dist.min.js',
'src/assets/template/js/fullcalendar.min.js',
'src/assets/template/js/select2.min.js',
'src/assets/template/js/bootstrap-colorpicker.min.js',
'src/assets/template/js/bootstrap-datepicker.min.js',
'src/assets/template/js/apexcharts.min.js',
'src/assets/template/js/app.min.js',
'src/assets/js/script.js'
], 'public/js/script.js');
Could not resolve this problem, so instead I found a replacement for laravel-mix
I used gulp and created my own scripts for parsing sass and mixing css,js and minification.
https://gulpjs.com/

Babel not transpiling chunk-vendors for IE11, in Vue-CLI project

I have a Vue-CLI webapp that needs to support IE11. In package.json we have set:
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8",
"ie 11"
]
and this seems to work for the generated app.x.js files: they don't contain any ... operators for instance.
However, the generated chunk-vendors.x.js do contain ... operators, and hence fail on IE11.
Relevant parts of the package.json:
"devDependencies": {
"#vue/cli-plugin-babel": "^3.3.0",
"#vue/cli-plugin-eslint": "^3.3.0",
"#vue/cli-service": "^3.3.0",
"babel-eslint": "^10.0.1",
"eslint": "^5.8.0",
"eslint-plugin-vue": "^5.0.0",
"pug": "^2.0.3",
"pug-plain-loader": "^1.0.0",
"vue-cli-plugin-pug": "^1.0.7",
"vue-template-compiler": "^2.5.21"
},
There are no relevant changes in vue.config.js, so the default behaviour is being used.
What do I need to change to ensure chunk-vendors.x.js is transpiled for IE11?
The answer seems to be, not so much "make sure all dependencies are transpiled" (which apparently can cause a lot of problems), but "make sure the specific dependencies which are causing issues are transpiled".
You can do this by adding a line to vue.config.js:
transpileDependencies: ['/node_modules/myproblematicmodule/']

Aurelia: History must implement activate()

I'm new to Aurelia, trying to implement some 'simple' dynamic routing with an id.
config.map([
{ route: 'questions/:id', . . .}
]);
I receive a runtime error which indicates I'm missing an activate() method.
aurelia-history.js:4 Uncaught (in promise) Error: History must implement activate().
at mi (aurelia-history.js:4)
at History.activate (aurelia-history.js:13)
at AppRouter.activate (aurelia-router.js:1743)
at aurelia-router.js:1722
I get that there is an activate() missing and it's dropping through to the prototype and throwing this error, I just can't figure out where to add the activate(). I have it in my module, but should I somehow have one in my App class or this history object?
Thanks
-John
Ok, for the benefit of other strugglers I tried to retrace my steps and piece together how I solved my problem - the challenge was I changed many variables.
But I believe I was able to re-create my error and I broke my application in the same way as before.
The error may have started appearing when I upgraded my aurelia-router version from 1.2.1 to 1.6.2.
This was my old package.json:
{
"name": "ClientWeb",
"private": true,
"version": "0.0.0",
"devDependencies": {
"#types/webpack-env": "^1.13.0",
"aspnet-webpack": "^2.0.1",
"aurelia-bootstrapper": "^2.0.1",
"aurelia-fetch-client": "^1.0.1",
"aurelia-framework": "^1.1.0",
"aurelia-loader-webpack": "^2.0.0",
"aurelia-pal": "^1.3.0",
"aurelia-router": "^1.2.1",
"aurelia-webpack-plugin": "^2.0.0-rc.2",
"bootstrap": "^3.3.7",
"css-loader": "^0.28.0",
"extract-text-webpack-plugin": "^2.1.0",
"file-loader": "^0.11.1",
"html-loader": "^0.4.5",
"isomorphic-fetch": "^2.2.1",
"jquery": "^3.2.1",
"json-loader": "^0.5.4",
"style-loader": "^0.16.1",
"ts-loader": "^2.0.3",
"typescript": "^2.2.2",
"url-loader": "^0.5.8",
"webpack": "^2.3.3",
"webpack-hot-middleware": "^2.18.0"
},
"dependencies": {
"#types/vis": "^4.21.7",
"vis": "^4.21.0"
}
}
At the time I was upgrading several libraries to the latest versions, but I tried reverting back to this original package.json and just updated the aurelia-router version - it generates the original error.
Hope this helps someone.
-John
The reason you have this issue is because you didn't include aurelia-history-browser in your plugins via: aurelia.use.history() or aurelia.use.standardConfiguration().
The aurelia-history-browser module implements the aurelia-history abstract class History, which is a wrapper around native History of browser. The abstract class History basically throw an error with the method name when you call it, like the error you saw.

Nuxt Hanging during generate script

When I try to run the generate script with nuxt my node process ends up hanging.
Nuxt goes through the generate step, but hangs with my console saying "Generate errors summary" and then nothing.
nuxt:render Rendering url / +5s
nuxt: Call generate:done hooks (1) +13ms
nuxt:generate HTML Files generated in 46.1s +14ms
Generate errors summary:
Has anyone run into this before?
Package.json:
"dependencies": {
"contentful": "^6.1.1",
"contentful-management": "^5.1.4",
"nuxt": "^1.4.0",
"vue-markdown": "^2.2.4"
},
"devDependencies": {
"babel-eslint": "^7.1.1",
"eslint": "^3.15.0",
"eslint-config-standard": "^6.2.1",
"eslint-loader": "^1.6.1",
"eslint-plugin-html": "^2.0.0",
"eslint-plugin-promise": "^3.4.1",
"eslint-plugin-standard": "^2.0.1"
}
Didn't have a CSS loader, added one and everything works.
From the documentation
Nuxt.js will automatically guess the file type by it's extension and use the
appropriate pre-processor loader for webpack. You will still need to install
the required loader if you need to use them.

Vue.js 2/Vuex - Scrollbar just breaks for some reason

Got a strange issue that i've not been able to easily replicate whilst building an app on vue.js 2 and vuex.
I've got a table where i can add and remove rows. The rows coming from the Vuex state and i've been commiting and mutating the state in the usual way and it's working great.
However, sometimes the window scrollbar just breaks and stops working so can't scroll up/down (or has the app hung?!). If I refresh the page, everything works again.
I get no errors and Vue dev tools doesn't report anything weird.
I also get the same issue in other browsers, thinking it might have something to do with Vue Tools (just to rule it out).
Be great to get any ideas on what the problem could be - if its a conflict with another library/package, memory leaking causing it to freeze/hang etc. Thanks in advance.
These are my package.json dev/dependancies:
devDependencies:
"babel-preset-stage-2": "^6.22.0",
"bootstrap-sass": "^3.3.7",
"cross-env": "^3.2.3",
"font-awesome": "^4.7.0",
"gulp": "^3.9.1",
"laravel-elixir": "^5.0.0",
"laravel-mix": "^0.9.2",
"nightwatch": "^0.9.13",
"nightwatch-tools": "^0.1.0",
"selenium-download": "^2.0.9",
"selenium-webdriver": "2.44.*"
Dependencies:
"animate-sass": "^0.6.6",
"axios": "^0.15.3",
"blueimp-md5": "^2.7.0",
"bootstrap-select": "^1.12.2",
"fecha": "^2.3.0",
"jasny-bootstrap": "^3.1.3",
"jquery": "^3.1.1",
"lodash": "^4.17.4",
"moment": "^2.18.1",
"sweetalert2": "^6.4.2",
"validator": "^7.0.0",
"vee-validate": "^2.0.0-beta.25",
"vue": "^2.2.3",
"vue-default-value": "^1.0.2",
"vue-loader": "^11.1.4",
"vue-localstorage": "^0.1.3",
"vue-multiselect": "^2.0.0-beta.15",
"vue-scrollto": "^2.4.2",
"vue-strap": "github:wffranco/vue-strap",
"vue-template-compiler": "^2.2.3",
"vue2-dragula": "^2.4.4",
"vue2-filters": "^0.1.6",
"vuex": "^2.1.2"
I managed to figure out the issue. Was an issue with using vue-strap spinner within a modal window and a rogue 'overflow-y:hidden' wasn't being removed on completion of that task causing the 'disabled' scroll.