Electron-vue: Getting Uncaught SyntaxError: Unexpected token < when using vue-keyboard

Created on 12 Jun 2017  路  3Comments  路  Source: SimulatedGREG/electron-vue

Hello I am trying to add virtual keyboard https://github.com/MartyWallace/vue-keyboard to my project , but I am keep getting this issue

/path/to/project/node_modules/vue-keyboard/src/keyboard.vue:1 Uncaught SyntaxError: Unexpected token <
    at createScript (vm.js:53)
    at Object.runInThisContext (vm.js:95)
    at Module._compile (module.js:543)
    at Object.Module._extensions..js (module.js:580)
    at Module.load (module.js:488)
    at tryModuleLoad (module.js:447)
    at Function.Module._load (module.js:439)
    at Module.require (module.js:498)
    at require (internal/module.js:20)
    at Object.<anonymous> (/path/to/project/node_modules/vue-keyboard/index.js:1)

System

  • Node version: 8.1.0
  • NPM version: 5.0.3
  • vue-cli version: 2.8.2
  • Operating System: Mac OS 10.12.5
question

Most helpful comment

@imomaliev

Assuming you are on a recent scaffold of electron-vue, there is a special case for some Vue component libraries, specifically those that provide raw *.vue files. Because webpack treats all dependencies as externals, vue-loader is never able to process this file. You will need to add vue-keyboard to the white-list for this to compile correctly. In theory, component libraries should be providing compiled versions of their components that use render functions, but that just isn't always the case in the real world.

https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals
https://github.com/SimulatedGREG/electron-vue/blob/master/template/.electron-vue/webpack.renderer.config.js#L14-L21

All 3 comments

@imomaliev

Assuming you are on a recent scaffold of electron-vue, there is a special case for some Vue component libraries, specifically those that provide raw *.vue files. Because webpack treats all dependencies as externals, vue-loader is never able to process this file. You will need to add vue-keyboard to the white-list for this to compile correctly. In theory, component libraries should be providing compiled versions of their components that use render functions, but that just isn't always the case in the real world.

https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals
https://github.com/SimulatedGREG/electron-vue/blob/master/template/.electron-vue/webpack.renderer.config.js#L14-L21

@SimulatedGREG Great! That helped. Thank you!

No problem. 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

blackw212 picture blackw212  路  3Comments

michalzaq12 picture michalzaq12  路  3Comments

rodrigomata picture rodrigomata  路  3Comments

Oriol-GG picture Oriol-GG  路  3Comments

kinoli picture kinoli  路  3Comments