Zulko / eagle.js

A hackable slideshow framework built with Vue.js
https://zulko.github.io/eaglejs-demo/
ISC License
4.08k stars 222 forks source link

SyntaxError: Unexpected token import when used in Nuxt.js #54

Closed Allanon29 closed 6 years ago

Allanon29 commented 6 years ago

I installed eagle through npm, and when I add it to a nuxt plugin: /plugins/eagle_slider.js

import Vue from 'vue'
import Eagle from 'eagle.js'
Vue.use(Eagle)

I get the following error:

{ D:\Sites\nuxt\batorangol\node_modules\eagle.js\dist\eagle.js:8
import { throttle } from 'lodash';
SyntaxError: Unexpected token import
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at r (D:\Sites\nuxt\batorangol\node_modules\vue-server-renderer\build.js:8330:16)
    at Object.<anonymous> (server-bundle.js:3847:18)
    at __webpack_require__ (webpack:/webpack/bootstrap 7f713d772752d58f1904:25:0)
    at Object.<anonymous> (plugins/core-components.js:1:0)
    at __webpack_require__ (webpack:/webpack/bootstrap 7f713d772752d58f1904:25:0)
    at Object.<anonymous> (.nuxt/index.js:1:0)
    at __webpack_require__ (webpack:/webpack/bootstrap 7f713d772752d58f1904:25:0) statusCode: 500, name: 'SyntaxError' }

package.json contains: "eagle.js": "^0.1.5"

Any idea why this happens?

Zulko commented 6 years ago

I believe this is related to #53

Allanon29 commented 6 years ago

@Zulko Thanks for the quick answer! @yaodingyd 's second answer helped.