CroudTech / vue-fullcalendar

FullCalendar Wrapper for vue
MIT License
483 stars 100 forks source link

Unexpected token error #87

Closed re1naldo closed 6 years ago

re1naldo commented 6 years ago

I followed the installation procedures on main page, but got this error when compiling the scripts:

ERROR in ./~/buble-loader?{"objectAssign":"Object.assign"}!./~/vue-loader/lib/selector.js?type=script&index=0&bustCache!./~/vue-full-calendar/components/FullCalendar.vue
Module parse failed: /var/www/html/hair/node_modules/buble-loader/index.js?{"objectAssign":"Object.assign"}!/var/www/html/hair/node_modules/vue-loader/lib/selector.js?type=script&index=0&bustCache!/var/www/html/hair/node_modules/vue-full-calendar/components/FullCalendar.vue Unexpected token (188:19)
You may need an appropriate loader to handle this file type.
|             while ( len-- ) options[ len ] = arguments[ len ];
| 
|             return var ref = $(this.$el);
|             ref.fullCalendar.apply(ref, options)
|         },

Do we need to install anything before installing vue-fullcalendar?

BrockReece commented 6 years ago

Hi @re1naldo,

What does your package.json look like? Is this a vue-cli based project?

re1naldo commented 6 years ago

Package.json:

{
  "private": true,
  "scripts": {
    "prod": "gulp --production",
    "dev": "gulp watch"
  },
  "devDependencies": {
    "bootstrap": "^4.0.0-beta.2",
    "gulp": "^3.9.1",
    "laravel-elixir": "^6.0.0-14",
    "laravel-elixir-vue-2": "^0.3.0",
    "laravel-elixir-webpack-official": "^1.0.9",
    "popper.js": "^1.12.9",
    "vue-loader": "^13.5.0",
    "vue-moment": "^2.0.2",
    "vue-resource": "^1.3.1",
    "vue-template-compiler": "^2.5.0"
  },
  "dependencies": {
    "axios": "^0.15.3",
    "jquery": "^3.2.1",
    "tinymce": "^4.7.3",
    "vue": "^2.1.8",
    "vue-full-calendar": "^2.5.1",
    "vue-notification": "^1.3.4",
    "vue-progressbar": "^0.7.3",
    "vue-router": "^2.1.1",
    "vue-tinymce": "git://github.com/garhbod/vue-tinymce.git#patch-2",
    "vuejs-datepicker": "^0.9.16"
  }
}

I generated the project from this repository.

BrockReece commented 6 years ago

Thanks for that, I have quickly had a look at that repository, it doesn't look like it has a babel.rc file? Could you copy in the output from this command? npm ls | grep babel

re1naldo commented 6 years ago

Output of npm ls | grep babel:

│ │ ├─┬ babel-code-frame@6.20.0
│ ├─┬ babel-plugin-transform-runtime@6.23.0
│ │ └─┬ babel-runtime@6.26.0
BrockReece commented 6 years ago

Oh sorry, I miss read your original post as a babel issue, not buble. I don't have much experience with buble, but I can try to help.

Have you read this yet? This sounds like the issue that you are experiencing.

BrockReece commented 6 years ago

@re1naldo Did you solve the issue in the end?

re1naldo commented 6 years ago

Unfortunately, no. I ended up using raw FullCalendar. Thank you for your support, anyway.

timothyjeffcoat commented 6 years ago

I had this exact same problem

I ended up forking the project.

Then I

npm install object-assign

Then I edited FullCalendar.vue replacing

        fireMethod(...options)) {
            return $(this.$el).fullCalendar(...options)
        },

with

        fireMethod(object2 = Object.assign({}, options)) {
            return $(this.$el).fullCalendar(object2)
        },

This replaced the spread operator with the Object.assign