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 Login from './components/Login.vue'
import VueRouter from 'vue-router' import VueRouter from 'vue-router'
import VueResource from 'vue-resource' import VueResource from 'vue-resource'
import auth from './auth'
Vue.use(VueResource) Vue.use(VueResource)
Vue.use(VueRouter) Vue.use(VueRouter)
import auth from './auth'
// Set default auth header // Set default auth header
Vue.http.headers.common['Authorization'] = 'Bearer ' + localStorage.getItem('id_token'); 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 // Check the user's auth status when the app starts
auth.checkAuth() 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({ router.map({
'/home': { '/home': {
@ -30,4 +44,4 @@ router.redirect({
'*': '/home' '*': '/home'
}) })
router.start(App, '#app') router.start(App, '#app')*/

View File

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