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

error:Uncaught ReferenceError: global is not defined at vue-dapp.js,just running a simple Hello World example #28

Closed
meta-bowen opened this issue Dec 7, 2021 · 2 comments

Comments

@meta-bowen
Copy link

I'm getting this weird error when I try to run an app with vue-dapp installed:
Uncaught ReferenceError: global is not defined at vue-dapp.js:71622
image

It's just a basic hello world project at this point.

main.js:

import { createApp } from 'vue';
import App from './App.vue';
import { VueDapp } from 'vue-dapp';

const app = createApp(App);

app.use(VueDapp);

app.mount('#app');

App.vue:

<template>
  <vdapp-board />
  <img alt="Vue logo" src="./assets/logo.png">
  <p>Hello</p>
</template>

<script>
export default {
  name: 'App',
}
</script>

<style>

</style>

And that's it.

I don't even need WalletConnect, I just want to run a simple app to try vue-dapp out.

Any idea how to solve this?

@meta-bowen
Copy link
Author

I built the base project using the following commands:

# npm 6.x
$ npm init vite@latest <project-name> --template vue

@meta-bowen meta-bowen changed the title Uncaught ReferenceError: global is not defined at vue-dapp.js:71622 error:Uncaught ReferenceError: global is not defined at vue-dapp.js,just running a simple Hello World example Dec 7, 2021
@johnson86tw
Copy link
Member

johnson86tw commented Dec 7, 2021

Hi @meta-bowen, take a look at these settings: https://github.com/chnejohnson/vue-dapp#using-vite

And ensuring that you're using latest vue-dapp version. (0.4.5)

Or you can directly refer to the setting of this project: https://github.com/chnejohnson/vue3-dapp-starter

Because Vite is only for ES module, it looks a little bit hacky to solve the problem that Vite can't import the built-in node.js package from the third-party modules. Refer to #20

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