alexurquhart/vue-bootstrap-typeahead

Module parse failed: Unexpected token (1:0)

rajesh-gs opened this issue · 7 comments

Sorry to dig up this thread again. I am also facing a similar issue

    ERROR in ./node_modules/vue-bootstrap-typeahead/src/components/VueBootstrapTypeahead.vue 1:0
    Module parse failed: Unexpected token (1:0)
    You may need an appropriate loader to handle this file type.
    > <template>
    |   <div>
    |     <div :class="sizeClasses">
     @ ./ClientApp/views/home.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./ClientApp/views/home.vue?vue&type=script&lang=js&) 2:0-97 35:27-48
     @ ./ClientApp/views/home.vue?vue&type=script&lang=js&
     @ ./ClientApp/views/home.vue
     @ ./ClientApp/router/routes.js
     @ ./ClientApp/router/index.js
     @ ./ClientApp/boot-app.js

I tried to provide full import path like @HasnatH 's but it still fails.
I am running
"vue": "2.5.16",
"vue-loader": "15.4.2",
"webpack": "^4.28.2",
"webpack-cli": "3.1.2",
"bootstrap-vue": "^2.0.0-rc.11",
"vue-bootstrap-typeahead": "^0.2.6",
"@babel/core": "7.2.2",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-runtime": "7.2.0",
"@babel/preset-env": "7.2.3",
"@babel/runtime": "7.2.0",

similar to #12

same here, i can't make this library to work in nuxtjs

+1

Skwal commented

same for me

+1

15 Mar 12:56:08 - error: undefined of node_modules/vue-bootstrap-typeahead/src/components/VueBootstrapTypeahead.vue failed. rror: Unexpected token (5:4) ^G

Had the same issue. My problem was related to my webpack vendor config. In my case I needed to add a .vue$ test referencing vue-loader that included node_modules/vue-bootstrap-typeahead to my vendor configuration (which previously didn't have a test for .vue files - my primary webpack config excluded node_modules). Everything seems to work fine after that.

Same here, how to parse this module so a standard nuxtjs config can import it as a plugin ?

Same here. Found a solution following the official documentation of nuxt : https://nuxtjs.org/guide/plugins

Create a nuxt plugin and don't forget to set build.transpile property in the nuxt.config according to the documentation.