updated webpack config

This commit is contained in:
kolaente 2017-11-09 10:30:17 +01:00
parent 0adb9a152a
commit 92b6da8720
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 37 additions and 9 deletions

3
assets/.babelrc Normal file
View File

@ -0,0 +1,3 @@
{
"presets": "env"
}

View File

@ -4,10 +4,10 @@ import Home from './components/Home.vue'
import Login from './components/Login.vue'
import VueRouter from 'vue-router'
import VueResource from 'vue-resource'
import auth from './auth'
Vue.use(VueResource)
Vue.use(VueRouter)
import auth from './auth'
// Set default auth header
Vue.http.headers.common['Authorization'] = 'Bearer ' + localStorage.getItem('id_token');
@ -15,7 +15,21 @@ Vue.http.headers.common['Authorization'] = 'Bearer ' + localStorage.getItem('id_
// Check the user's auth status when the app starts
auth.checkAuth()
export var router = new VueRouter()
//export var router = new VueRouter()
const routes = [
{ path: '/home', component: Home },
{ path: '/login', component: Login }
]
export const router = new VueRouter({
routes // kurz für 'routes: routes'
})
const app = new Vue({
router
}).$mount('#app')
/*
router.map({
'/home': {
@ -30,4 +44,4 @@ router.redirect({
'*': '/home'
})
router.start(App, '#app')
router.start(App, '#app')*/

View File

@ -1,7 +1,9 @@
// TODO:
// * EsLint
// * bessere struktur
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
module.exports = {
// the main entry of our app
@ -9,8 +11,12 @@ module.exports = {
// output configuration
output: {
path: __dirname + '/dist/',
publicPath: 'assets/dist/',
filename: 'app.js'
publicPath: 'assets/dist/'
},
resolve: {
alias: {
vue: 'vue/dist/vue.min.js'
}
},
// how modules should be transformed
module: {
@ -24,13 +30,18 @@ module.exports = {
// the exclude pattern is important so that we don't
// apply babel transform to all the dependencies!
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
/* test: /\.js$/,
//exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
/*options: {
presets: ['@babel/preset-env']
}*/
}*
}*/
test: /\.js?$/,
loader: 'babel-loader',
query: {
presets: ['env']
}
}
]