forked from sohelamin/electron-vue-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
108 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"presets": [ | ||
["es2015", { "modules": false }] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,21 @@ | ||
const Vue = require('vue') | ||
const VueRouter = require('vue-router') | ||
import Vue from 'vue' | ||
import VueRouter from 'vue-router' | ||
|
||
const App = require('./App.vue') | ||
|
||
var Main = Vue.extend({}) | ||
import App from './App.vue' | ||
|
||
Vue.use(VueRouter) | ||
|
||
const Contacts = require('./components/Contacts.vue') | ||
const Music = require('./components/Music.vue') | ||
|
||
var router = new VueRouter() | ||
import Contacts from './components/Contacts.vue' | ||
import Music from './components/Music.vue' | ||
|
||
router.map({ | ||
'/': { | ||
component: App | ||
}, | ||
'/contacts': { | ||
component: Contacts | ||
}, | ||
'/music': { | ||
component: Music | ||
} | ||
var router = new VueRouter({ | ||
routes: [ | ||
{ path: '/', component: App }, | ||
{ path: '/contacts', component: Contacts }, | ||
{ path: '/music', component: Music } | ||
] | ||
}) | ||
|
||
router.start(Main, '#app') | ||
const app = new Vue({ | ||
router | ||
}).$mount('#app') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,58 @@ | ||
var path = require('path') | ||
var webpack = require('webpack') | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
entry: './src/app.js', | ||
output: { | ||
path: './dist', | ||
publicPath: 'dist/', | ||
path: path.resolve(__dirname, './dist'), | ||
publicPath: '/dist/', | ||
filename: 'build.js' | ||
}, | ||
resolve: { | ||
alias: {vue: 'vue/dist/vue.js'}, | ||
root: path.join(__dirname, '..'), | ||
extensions: ['', '.js', '.json', '.vue'] | ||
}, | ||
target: 'electron', | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.vue$/, | ||
loader: 'vue' | ||
}, | ||
{ | ||
// edit this for additional asset file types | ||
test: /\.(png|jpg|gif)$/, | ||
loader: 'file?name=[name].[ext]?[hash]' | ||
test: /\.js$/, | ||
loader: 'babel', | ||
exclude: /node_modules/ | ||
}, | ||
{ | ||
test: /\.(png|jpg|gif|svg)$/, | ||
loader: 'file', | ||
query: { | ||
name: '[name].[ext]?[hash]' | ||
} | ||
} | ||
] | ||
}, | ||
// example: if you wish to apply custom babel options | ||
// instead of using vue-loader's default: | ||
babel: { | ||
presets: ['es2015', 'stage-0'], | ||
plugins: ['transform-runtime'] | ||
devServer: { | ||
historyApiFallback: true, | ||
noInfo: true | ||
}, | ||
resolve: { | ||
root: path.join(__dirname, '..'), | ||
extensions: ['', '.js', '.json', '.vue'] | ||
}, | ||
target: 'electron' | ||
devtool: '#eval-source-map' | ||
} | ||
|
||
if (process.env.NODE_ENV === 'production') { | ||
module.exports.plugins = [ | ||
module.exports.devtool = '#source-map' | ||
module.exports.plugins = (module.exports.plugins || []).concat([ | ||
new webpack.DefinePlugin({ | ||
'process.env': { | ||
NODE_ENV: '"production"' | ||
} | ||
}), | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { | ||
warnings: false | ||
} | ||
}), | ||
new webpack.optimize.OccurenceOrderPlugin() | ||
] | ||
} else { | ||
module.exports.devtool = '#source-map' | ||
compress: { | ||
warnings: false | ||
} | ||
}) | ||
]) | ||
} |