File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ dist
Original file line number Diff line number Diff line change 1+ # Electron with webpack and Vue.js
2+
3+ > [ https://youtu.be/oL7vIDkDOsg ] ( https://youtu.be/oL7vIDkDOsg )
4+
5+ Install [ Node.js] ( https://nodejs.org/ ) .
6+
7+ Within this folder run the terminal command ` npm install ` to install the
8+ ` dependencies ` and ` devDependencies ` .
9+
10+ Then run ` npm start ` to run the app.
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " electron-webpack-vuejs" ,
3+ "version" : " 0.1.0" ,
4+ "description" : " " ,
5+ "main" : " index.js" ,
6+ "scripts" : {
7+ "start" : " electron-webpack dev" ,
8+ "build" : " electron-webpack && electron-builder"
9+ },
10+ "author" : " Kyle Robinson Young <kyle@dontkry.com> (http://dontkry.com)" ,
11+ "license" : " MIT" ,
12+ "devDependencies" : {
13+ "electron" : " ^2.0.2" ,
14+ "electron-builder" : " ^20.15.1" ,
15+ "electron-webpack" : " ^2.1.2" ,
16+ "vue" : " ^2.5.16" ,
17+ "vue-loader" : " ^15.2.2" ,
18+ "vue-template-compiler" : " ^2.5.16" ,
19+ "webpack" : " ^4.9.1"
20+ },
21+ "dependencies" : {
22+ "source-map-support" : " ^0.5.6"
23+ }
24+ }
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html >
3+ < head >
4+ < title > < %= process.env.npm_package_productName %> </ title >
5+ < meta charset ="utf-8 ">
6+ < script >
7+ < % if ( htmlWebpackPlugin . options . nodeModules ) { % >
8+ require ( 'module' ) . globalPaths . push (
9+ '<%= htmlWebpackPlugin.options.nodeModules %>' . replace ( / \\ / g, '\\\\' ) ,
10+ )
11+ < % } % >
12+ require ( 'source-map-support/source-map-support.js' ) . install ( )
13+ </ script >
14+ </ head >
15+ < body >
16+ < div id ="app "> </ div >
17+ </ body >
18+ </ html >
Original file line number Diff line number Diff line change 1+ import { app , BrowserWindow } from 'electron'
2+ import path from 'path'
3+ import { format as formatUrl } from 'url'
4+
5+ const isDevelopment = process . env . NODE_ENV !== 'production'
6+
7+ app . on ( 'ready' , ( ) => {
8+ let window = new BrowserWindow ( {
9+ width : 1024
10+ } )
11+ if ( isDevelopment ) {
12+ window . loadURL ( `http://localhost:${ process . env . ELECTRON_WEBPACK_WDS_PORT } ` )
13+ } else {
14+ window . loadURL ( formatUrl ( {
15+ pathname : path . join ( __dirname , 'index.html' ) ,
16+ protocol : 'file' ,
17+ slashes : true
18+ } ) )
19+ }
20+ } )
Original file line number Diff line number Diff line change 1+ <template >
2+ <div >{{name}}</div >
3+ </template >
4+
5+ <script >
6+ export default {
7+ data () {
8+ return {
9+ name: ' Obligatory Bear'
10+ }
11+ }
12+ }
13+ </script >
Original file line number Diff line number Diff line change 1+ import Vue from 'vue'
2+ import App from './App.vue'
3+ new Vue ( {
4+ el : '#app' ,
5+ render ( h ) {
6+ return h ( App )
7+ }
8+ } )
Original file line number Diff line number Diff line change 1+ const VueLoaderPlugin = require ( 'vue-loader/lib/plugin' )
2+ module . exports = {
3+ module : {
4+ rules : [
5+ {
6+ test : / \. v u e $ / ,
7+ use : 'vue-loader'
8+ }
9+ ]
10+ } ,
11+ plugins : [
12+ new VueLoaderPlugin ( )
13+ ]
14+ }
You can’t perform that action at this time.
0 commit comments