soixantecircuits / idle-vue

Vue component wrapper for idle-js
MIT License
125 stars 40 forks source link

Error when importing idle-vue #14

Closed negabakuru closed 7 years ago

negabakuru commented 7 years ago

I want to use idle-vue in an electron app using https://github.com/SimulatedGREG/electron-vue, but when I import idle-vue in my main.js file it throws an error:

Uncaught SyntaxError: Unexpected token import
    at createScript (vm.js:53:10)
    at Object.runInThisContext (vm.js:95:10)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at eval (eval at <anonymous> (http://localhost:9080/renderer.js:1959:1), <anonymous>:1:18)

The main.js looks like this:

import 'basscss/css/basscss.min.css'
import 'flexboxgrid/css/flexboxgrid.min.css'

import 'gsap'

import Vue from 'vue'
import axios from 'axios'

import App from './App'
import router from './router'
import store from './vuex/store'
import i18n from './locales/index'
import IdleVue from 'idle-vue'

import './lib/qrcode'

if (!process.env.IS_WEB) Vue.use(require('vue-electron'))
Vue.http = Vue.prototype.$http = axios
Vue.config.productionTip = false

Vue.use(IdleVue, { store })

/* eslint-disable no-new */
new Vue({
  components: { App },
  router,
  store,
  i18n,
  template: '<App/>'
}).$mount('#app')

It might happen because of a bad babel-loader configuration

PoignardAzur commented 7 years ago

Any luck figuring out why this happens? I haven't come across it, so if you still don't know where it's from, could you send me a link to a commit with this error?

langerc commented 7 years ago

Got the same issue. Anyone resolved that?

rajeshwar-fissionhq commented 7 years ago

I too had the same issue. Still not working, beause for main key u mentioned dist/index.js but in the actual directory there is no index file in dist folder. screen shot 2017-08-30 at 2 48 05 pm

hugohil commented 7 years ago

Thank you for pointing this out @rajeshwar-fissionhq, it is now fixed with 2.0.3.