Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket.io-client error in new vue-cli 3.0: global is not defined #774

Closed
weixiao-huang opened this issue Feb 4, 2018 · 1 comment
Closed

Comments

@weixiao-huang
Copy link

I use vue-cli 3.0.0-alpha.7 to create a new default project as below:

wx20180204-162311 2x

Than I add socket.io-client by using

yarn add socket.io-client

and use it in App.vue as below:

<script>
import HelloWorld from './components/HelloWorld.vue'
import io from 'socket.io-client'

export default {
  name: 'app',
  components: {
    HelloWorld
  },
  created() {
    const socket = io('/home')
    socket.on('hello world', (hello) => {
      console.log('hello: ', hello)
    })
  },
}
</script>

However, I got an error about Uncaught ReferenceError: global is not defined

screen shot 2018-02-04 at 4 28 22 pm

This seems not the bug of socket.io-client since I have no error in the project generated by legacy vue-cli 2.

@vue-bot
Copy link

vue-bot commented Feb 4, 2018

Hello, your issue has been closed because it does not conform to our issue requirements. In order to ensure every issue provides the necessary information for us to investigate, we require the use of the Issue Helper when creating new issues. Thank you!


你好,你的 issue 不符合我们所要求的格式,因此已被自动关闭。为了确保每个 issue 都提供必需的相关信息,请务必使用我们的 Issue 向导 来创建新 issue,谢谢!

@vue-bot vue-bot closed this as completed Feb 4, 2018
yyx990803 added a commit that referenced this issue Feb 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants