Skip to content

Commit 50c15d7

Browse files
authored
Merge pull request #21 from lukedawilson/patch-1
Add vuejs/vite workaround to README
2 parents c13b78c + 1aa1df7 commit 50c15d7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,21 @@ console.log('executeContract:', result.constructor.name, JSON.stringify(result,
7070
result = await app.wasm.query(contractAddress, { get_count: {} });
7171
console.log('query:', result.constructor.name, JSON.stringify(result, null, 2));
7272
```
73+
74+
## Using with Vue.js and vite
75+
76+
Vite doesn't include shims for Node variables like Webpack 4 does, and cw-simulate currently relies on these. The following workaround exists:
77+
78+
1. Add the `buffer` package (`npm add buffer`)
79+
2. Add the following to your `index.html` (inside the `body` tag, before your other js imports):
80+
```html
81+
<script>
82+
window.global = window;
83+
</script>
84+
<script type="module">
85+
import {Buffer} from "buffer";
86+
window.Buffer = Buffer;
87+
</script>
88+
```
89+
90+
See [this github issue](https://github.com/vitejs/vite/issues/2618) for more details.

0 commit comments

Comments
 (0)