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

ReferenceError: production is not defined #24

Closed Tebra closed 6 years ago

Tebra commented 6 years ago

The error message:

vue.runtime.esm.js?ff9b:352 Uncaught (in promise) ReferenceError: production is not defined
at Object.eval (vue.runtime.esm.js?ff9b:352)
at eval (vue.runtime.esm.js?ff9b:7921)
at Object.<anonymous> (vue-aplayer.min.js:1)
at e (vue-aplayer.min.js:1)
at eval (7:1)
at Object.<anonymous> (vue-aplayer.min.js:1)
at e (vue-aplayer.min.js:1)
at eval (23:2)
at Object.<anonymous> (vue-aplayer.min.js:1)
at e `(vue-aplayer.min.js:1)`

The place where vue.runtime throws the error: productionTip: process.env.NODE_ENV !== 'production',

Current Version "vue-aplayer": "^1.1.0"

I used a laravel-vue template then I created my own wrapper for the vue-aplayer and it worked beautifully up until now.

Steps to reproduce:

In the console you get the error above.

Without this library everything functions normally. I hope you can show me the way! If you have an idea where the issue could be, that would be great.

All the best!

SevenOutman commented 6 years ago

@Tebra Looks like the 'production' in that productionTip line somehow happened to be not quoted. I will investigate into it later today.

Tebra commented 6 years ago

@SevenOutman Maybe you could change the webpack config and add JSON.stringify way of defining enviroment variables:

new webpack.DefinePlugin({
  'process.env': {
    NODE_ENV: JSON.stringify('production')
  }
}),

Taken from a similar error from React : React Issue

From the comment made by the user gaearon

SevenOutman commented 6 years ago

@Tebra You're right, that's exactly where the problem was. It's been fixed in vue-aplayer@1.1.1. Thank you very much.

Tebra commented 6 years ago

Hey thanks for the quick fix! Glad to be of some help, thanks again for doing this!

This player really helped out in my project, so mad respect!

SevenOutman commented 6 years ago

@Tebra Glad you like it! Btw I'll be working on a music service package for Laravel too and hopefully these two packages will work together well. Make sure to keep an eye on it if you're interested.