SevenOutman / vue-aplayer

:cake: Easy-to-use music player for Vue 2.x
https://vue-aplayer.js.org
MIT License
1.33k stars 201 forks source link

Unexpected token: operator (>) #17

Closed afuno closed 6 years ago

afuno commented 6 years ago

Error:

Unexpected token: operator (>) [./node_modules/vue-aplayer/src/utils.js:11,0][posts-65b31383fe39c33c7e6b.js:52227,26]

I use almost pure Rails 5.1.4.

SevenOutman commented 6 years ago

@afuno You are supposed to use dist/vue-aplayer.min.js rather than any js files in src.

If you are using npm and ES modules, you should import vue-aplayer as described here.

If you are not familiar with npm-based frontend development, you can just add a <script> tag in your template file (e.g. html file) like this:

<script type="text/javascript" "src="//unpkg.com/vue-aplayer/dist/vue-aplayer.min.js" />

Hope this helps.

afuno commented 6 years ago

@SevenOutman I use as an ES module.

SevenOutman commented 6 years ago

@afuno I see. Did you set up your webpack to use vue-loader to process .vue files? You can find an example config at my webpack.config.js:Line 15

afuno commented 6 years ago

@SevenOutman The problem arises from pure Rails 5.1.4. Together with Rails was installed Webpack(er). I have no problem with any other installed package.

SevenOutman commented 6 years ago

@afuno So you mean you didn’t do anything with webpack, including configuring it to be capable to work with Vue(which you SHOULD do), right?

If so, check out the link in my previous comment, or refer to Vue docs to see what you are supposed to do with webpack so that it can work with Vue correctly.

SevenOutman commented 6 years ago

Should be fixed in 1.0.2 update